Vale chicos, ya lo he conseguido, muchas gracias (me queda mucho por aprender). Pongo el código que he usado. Lo he encontrado en una web.
Código PHP:
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, "C:\cookieFileName");
curl_setopt($ch, CURLOPT_URL,"http://sitio.lan/OUT/out_index.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "txtLOGIN=usuario&txtCLAVE=password&sub=Entrar");
ob_start(); // prevent any output
curl_exec ($ch); // execute the curl command
ob_end_clean(); // stop preventing output
curl_close ($ch);
unset($ch);
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_COOKIEFILE, "C:\cookieFileName");
curl_setopt($ch, CURLOPT_URL,"http://sitio.lan/GST/gst_index.php");
$buf2 = curl_exec ($ch);
curl_close ($ch);
echo "<PRE>".htmlentities($buf2);
Teniendo esto yo creo que con lo siguiente ya me apañaré.