Ver Mensaje Individual
  #4 (permalink)  
Antiguo 20/04/2011, 10:24
diego007007
 
Fecha de Ingreso: enero-2009
Ubicación: en la casa
Mensajes: 223
Antigüedad: 15 años, 2 meses
Puntos: 3
Respuesta: Uso de CURL para autentificarse en servidor ISS

Extraje el header de la pagina escribí este código, pero no trabaja
Código PHP:
array(9) { 
[
0]=> string(25"HTTP/1.1 401 Unauthorized" 
[1]=> string(17"Connection: Close" 
[2]=> string(35"Date: Wed, 20 Apr 2011 16:06:23 GMT" 
[3]=> string(20"Content-Length: 1656" 
[4]=> string(23"Content-Type: text/html" 
[5]=> string(25"Server: Microsoft-IIS/6.0" 
[6]=> string(27"WWW-Authenticate: Negotiate" 
[7]=> string(22"WWW-Authenticate: NTLM" 
[8]=> string(21"X-Powered-By: ASP.NET" 
Código PHP:
$header[] = "HTTP/1.1 401 Unauthorized";  
$header[] = "Connection: Close";
$header[] = "Date: Wed, 20 Apr 2011 16:06:23 GMT";  
$header[] = "Content-Length: 1656"
$header[] = "Content-Type: text/html";  
$header[] = "Server: Microsoft-IIS/6.0";  
$header[] = "WWW-Authenticate: Negotiate";  
$header[] = "WWW-Authenticate: NTLM";  
$header[] = "X-Powered-By: ASP.NET";
$ch curl_init(); 
curl_setopt($chCURLOPT_URL,'http://miusuario:[email protected]/?p=view&pg=2'); 
curl_setopt($curlCURLOPT_HTTPHEADER$header); 
curl_setopt($curlCURLOPT_USERAGENT'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)'); 
curl_setopt($chCURLOPT_RETURNTRANSFER1); 
curl_setopt($chCURLOPT_FOLLOWLOCATION1); 
$page curl_exec ($ch); 
curl_close ($ch);
echo 
$page
que estoy haciendo mal???

Última edición por jpinedo; 20/04/2011 a las 19:02 Razón: a pedido del usuario