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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.