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: 16 años, 3 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($chCURLOPT_COOKIEJAR"C:\cookieFileName");
curl_setopt($chCURLOPT_URL,"http://sitio.lan/OUT/out_index.php");
curl_setopt($chCURLOPT_POST1);
curl_setopt($chCURLOPT_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($chCURLOPT_RETURNTRANSFER,1);
curl_setopt($chCURLOPT_COOKIEFILE"C:\cookieFileName");
curl_setopt($chCURLOPT_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é.