A script that logs in to multiple websites at once. CURL and PHP tried. A script that logs in to multiple websites at once. CURL and PHP tried. curl curl

A script that logs in to multiple websites at once. CURL and PHP tried.


The problem you are facing relates to the security principles of cookies. You cannot set cookies for other domains, which means that myserver cannot set a cookie for facebook.com, for example.

You could set your server to run an HTTP proxy and make it so that all queries run through your server and do some kind of URL translation (e.g. facebook.com => facebook.myserver) which then in return allows you to set cookies for the clients (since you're running on facebook.myserver) and then translates cookies you receive from the clients and feed them to the third party websites.

An example of a non-transparent proxy that you could begin with: http://www.phpmyproxy.com/

Transparent proxies (in which URLs remain "correct" / untranslated) might be worth considering too. Squid is a pretty popular one. Can't say how easy this would be, though.

After all that you'll still need to build a local script for myserver that takes care of the login process, but at least a proxy should make it all possible.

If you have any say in the login process itself, it might be easier to set up all the services to use OpenID or similar login services, StackOverflow and its sister sites being a prime example on how easy login on multiple sites can be achieved.