Ver Mensaje Individual
  #2 (permalink)  
Antiguo 22/05/2015, 07:58
Avatar de TamyZamb
TamyZamb
 
Fecha de Ingreso: mayo-2015
Mensajes: 6
Antigüedad: 9 años
Puntos: 0
Respuesta: Página en blanco cuando consulto con cURL

Lo he intentado así:

<?php
$url="https://www.example.com";
$creds="[email protected]:7777777";

$c = curl_init();

curl_setopt($c, CURLOPT_URL,$url);
curl_setopt($c, CURLOPT_RETURNTRANSFER,TRUE);
curl_setopt($c, CURLOPT_VERBOSE, 1);
curl_setopt($c, CURLOPT_HTTPHEADER,array('Authorization:Basic'.bas e64_encode($creds)));
curl_setopt($c, CURLOPT_FOLLOWLOCATION, TRUE);
$result=curl_exec($c);

curl_close($c);

print_r ($result);

?>


Ahora obtengo un error:
{"errorDetails":{"errorCode":401,"sourceErrorEntit y":null,"userMessage":"This resource requires authentication. Please make sure it's including basic authentication in request headers.","developerMessage":"Bad or missing credentials","moreInfoUrl":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2"}}


Pero no sé que puede estar mal, ya que la autenticación esta bien ... Es decir, email y password. Alguna idea?