php 如何通过PHP登录到另一个站点
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4873783/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to login to another site via PHP
提问by
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
我想知道如何通过 PHP 登录到另一个站点...我不知道它的正确术语,但基本上,我希望用户能够输入我的另一个网站的登录信息,并进行交互通过我的。有教程吗?谢谢
采纳答案by CronosS
There are few ways to do the job (actually, you just need to send POST data to the other site).
有几种方法可以完成这项工作(实际上,您只需要将 POST 数据发送到另一个站点)。
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).
curl(例如:http: //davidwalsh.name/execute-http-post-php-curl),
流上下文(例如:http: //php.net/manual/en/function.stream-context-create.php),
或直接使用套接字(例如:http: //www.jonasjohn.de/snippets/php/post-request.htm)。
回答by dogmatic69
curl will do that PHP, cURL post to login to WordPress
curl 将执行PHP、cURL 发布以登录 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
但是您需要在服务器上安装它,这有时不是一个选项。然而,有大量脚本可以在不安装 curl 库的情况下执行与 curl 相同的操作,例如:cakephp 的 HttpSocket 类