Foros del Web » Programando para Internet » PHP »

Librería CURL y Bad Request

Estas en el tema de Librería CURL y Bad Request en el foro de PHP en Foros del Web. Hola amigos! Estoy intentando leer desde un script php esta url: http://www.apparelcandy.com/product-...6grn-1-3-2.htm Para ello utilizo este script con curl: //**************** LEO DE LA TIENDA ****************************** ...
  #1 (permalink)  
Antiguo 23/01/2013, 05:51
 
Fecha de Ingreso: noviembre-2002
Mensajes: 73
Antigüedad: 21 años, 5 meses
Puntos: 0
Librería CURL y Bad Request

Hola amigos! Estoy intentando leer desde un script php esta url: http://www.apparelcandy.com/product-...6grn-1-3-2.htm

Para ello utilizo este script con curl:

//**************** LEO DE LA TIENDA ******************************
ini_set('user_agent','Mozilla: (compatible; Windows XP)');
$query="http://www.apparelcandy.com/product-p/33-h30-7x506grn-1-3-2.htm";
$curl = curl_init();
# Create Curl Object
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0);
# Allow self-signed certs
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0);
# Allow certs that do not match the hostname
curl_setopt($curl, CURLOPT_HEADER,0);
# Do not include header in output
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
# Return contents of transfer on curl_exec
# set the username and password
curl_setopt($curl, CURLOPT_URL, $query);
# execute the query
$html = curl_exec($curl);
if ($html == false)
{
echo("curl_exec threw error \"" . curl_error($curl) . "\" for $query");
# log error if curl exec fails
}
curl_close($curl);

Hasta hace unos días funcionaba lo mas bien, pero desde poco obtengo en $html solamente "Bad Request"

¿alguien me puede dar una mano de como solucionarlo?

Saludos y gracias.
__________________
Marcelo :-)
música en mp3
Noticias de tecnología

Etiquetas: bar, curl, request
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:12.