hugotkt Posted July 5, 2010 Share Posted July 5, 2010 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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.