Jump to content

missing something in cURL


hugotkt

Recommended Posts

Hello,

 

This is my first post here.

 

I have this case that when using curl, I am not getting the whole html.

 

This is the URL: http://emtmadrid.es/aplicaciones/Espera.aspx?parada=711&linea=74

 

On the browser (Firefox), I get a text on the right top of the screen, this the HTML of that part:

 

<h3><span id="Label3" title="EMT Informa: El próximo autobús se encuentra a 1220 metros. Tiempo estimado de llegada: 9 minutos. El siguiente llegará en 32 minutos.<br>">EMT Informa: El próximo autobús se encuentra a 1220 metros. Tiempo estimado de llegada: 9 minutos. El siguiente llegará en 32 minutos.<br></span></h3>

 

But when I connect with curl, the text is missing, this is what I get:

<h3><span id="Label3"></span></h3>

 

This is my PHP code:

$url = 'http://emtmadrid.es/aplicaciones/Espera.aspx?parada=711&linea=74';
$useragent = 'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; es-ES; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 FirePHP/0.4';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR,'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($ch, CURLOPT_REFERER, $url);
$html = curl_exec($ch);
$error = curl_errno($ch);

curl_close($ch);
echo $html;

 

Any ideas of what can be happening? Am I missing any parameter?

 

Regards!

Link to comment
https://forums.phpfreaks.com/topic/206808-missing-something-in-curl/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.