When I try to browse to yahoo.com via cURL and Firefox, it does not work. When I try to browse to yahoo.com through Firefox alone, it does work. When I try to browse via cURL and Chrome, it does work. What gives? Why can’t I browse with cURL passing along my actual Firefox useragent info, but I CAN with Chrome’s useragent info?
And why can I browse normally from Firefox just not through cURL?
Yes. As a matter of fact, after lots of testing, I found that the site loads via cURL on Firefox ONLY when I set the user-agent to NOT include the word “Firefox” in the user-agent string. So
works. And as of right now, using Firefox through cURL doesn’t work.
P.S. on Chrome and Safari through cURL, I set the user-agent string to be a valid Firefox string and POOF, all of a sudden it doesn’t work. So it definitely has to do with cURL + word “Firefox” in the user-agent string. Why?! I don’t know!
Is cURL outputting the user agent string exactly the same as your browser?
Reason i ask is yahoo are known for not liking some browsers and if they can’t recognise a browser (eg curl screws up the name or puts in a line terminator) then their configuration might not want to serve you / cURL.
They don’t like Seamonkey at all and refuse to allow it access to the new yahoo.
Perhaps you could post the headers from both your firefox and the cURL for us to look at? - By headers i mean the client and server headers. There must be something causing this.
Thanks for your help thus far in trying to figure this out with me. Is grabbing the client and server headers possible to achieve without using a packet sniffer like Wireshark?
P.S.
user-agent string Firefox through cURL:
Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
user-agent string Firefox only
Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
This is great. Thank you very much.
So I still wonder why this wasn’t working before when cURLing w/ Firefox. Maybe when you cURL with Firefox as the user-agent it doesn’t have those Accept headers?? But with Chrome and Safari you do I guess. Weird.