I wanted to find out how to login to another site via PHP... I don't know the proper term for it, but basically, I want a user to be able to enter their login information for another website on mine, and interact with it through mine.Is there any tutorial? thanks
-
4You need to use Curl - http://php.net/manual/en/book.curl.php – Jake N Feb 02 '11 at 11:20
-
Most sites not welcome such a behavior. what site you're trying to log in? – Your Common Sense Feb 02 '11 at 11:28
-
ISP site http://10.240.43.216 . – Feb 02 '11 at 11:32
3 Answers
There are few ways to do the job (actually, you just need to send POST data to the other site).
You can use :
curl (example: http://davidwalsh.name/execute-http-post-php-curl),
stream context (example: http://php.net/manual/en/function.stream-context-create.php),
or directly with sockets (example: http://www.jonasjohn.de/snippets/php/post-request.htm).
- 3,129
- 3
- 21
- 28
curl will do that PHP, cURL post to login to WordPress
but you will need that installed on the server which is sometimes not an option. There is however loads of scripts that can do the same thing as curl without the curl libs installed, eg: cakephp's HttpSocket class
- 1
- 1
- 7,574
- 4
- 31
- 49
as already stated, Curl will do that. But you can also check out this PHP Class that makes everything easier and gives you a lot of automation out of the Box Including Prefilling of CSRF Token, finding of all input fields, retrieving of details from the designated site. etc the class can be found Here. Crawl Engine
- 1
- 2