Ver Mensaje Individual
  #8 (permalink)  
Antiguo 13/08/2009, 09:10
Avatar de cluster28
cluster28
 
Fecha de Ingreso: enero-2008
Ubicación: Donostia - San Sebastián
Mensajes: 756
Antigüedad: 18 años, 8 meses
Puntos: 32
Respuesta: Acceso a http con Curl

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é.