tags:

views:

56

answers:

3

Hi,

I'm having some problems logging on to a site via cURL (not just me but an outsourcer too). So I'm left wondering: Are some sites impossible to log onto via cURL?

That's the question. Thx in advance for your replies!

+2  A: 

It's just an HTTP request. It could be that they're blocking the UserAgent curl sends with its requests.

You could make it spoof a common browser (like firefox) instead.

 $useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1";

$ch = curl_init();

// set user agent
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
linead
A: 

Are you sure you're properly handling any cookies the server sends? It's very possible that you need to pick up a cookie from the first page and return it with the user information. I'd login to the system with a browser, watching all the headers that go back and forth, check all cookies at each stage, and watch out for and scripts that might edit the cookies or the transferred data.

acrosman
A: 

No site is impossible to login via cURL, but a lot of sites intentionally make it difficult to login to them programmatically in order to reduce spammers. They do silly cookie tricks, use Javascript to set dynamic form fields, get cookies from GIFs, and all kinds of things.

An application like HTTP Analyzer is really useful for figuring out this type of thing.

Gerald