php - Find destination URL using cURL -


i'm trying destination url using curl.

<?php $ch = curl_init('http://www.cnn.com'); curl_setopt($ch, curlopt_useragent, "mozilla/5.0 (windows nt 6.1) applewebkit/537.31 (khtml, gecko) chrome/26.0.1410.64 safari/537.31"); curl_setopt($ch, curlopt_referer, "http://www.mydomain.com/"); curl_setopt($ch, curlopt_followlocation, true); curl_setopt($ch, curlopt_returntransfer, true); $content = curl_exec($ch); echo $lasturl = curl_getinfo($ch, curlinfo_effective_url); curl_close($ch); ?> 

the above code produces following outputs, , it's working fine in local server.

output : "http://edition.cnn.com" in local server, , "http://www.cnn.com" in actual server.

------------------------------------------------------                     server detail ------------------------------------------------------ local                    |            actual                          | php version 5.3.13       |      php version 5.3.20 curl info 7.24.0         |      curl info 7.15.5  protocols:       dict, file, ftp,         |      telnet, dict, ftps, gopher,            |      ldap, http, http, https,             |      file, https, ftps imap, imaps, ldap,       |      tftp,ftp, pop3, pop3s,             | rtsp, scp,               | sftp, smtp,              | smtps,                   | telnet, tftp             | ------------------------------------------------------- 

why there problem in actual server?

why there problem in actual server?

my guess cnn using headers or ip show different content.

try firefox plugin http live headers see browser does, , copy in curl.


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -