如何对外部API(vBulletin)发出POST请求?

时间:2011-12-29 03:18:44

标签: php api post vbulletin

您通常如何使用PHP对API进行POST?

例如:

login_login
Login a user and return a new session hash

Parameters
POST (Required)
vb_login_username - Username to login
Note that one of 3 vb_login_*password* methods is required.
vb_login_password - The password of the User. If client use this to login, the plain password may be sniffed during the pass in the network
vb_login_md5password - The md5 password of the User
vb_login_md5password_utf - The md5 password (Unicode) of the User

POST (Optional)
logintype - Possible value: 'cplogin' or empty. 'cplogin' means that the login will also allow the user to access the AdminCP if they have permission.

见这里:https://www.vbulletin.com/forum/content.php/365-User-Related-Methods

更多信息:https://www.vbulletin.com/forum/content.php/334-mobile-api

那么,如果API脚本位于http://somedomain.com/api.php,我将如何对API进行POST?

如果我将FORM ACTION设置为外部API页面,它会将用户发送到该外部站点,这显然不是正确的方法。

我是否必须进行cURL POST?但对于简单的API调用来说,这似乎很复杂。

或者API通常以不同且更直接的方式理解POST请求吗?

2 个答案:

答案 0 :(得分:1)

找到我想要的答案:

http://code.google.com/apis/chart/image/docs/post_requests.html

请参阅“将PHP用于POST请求”。

非常直接且有效。

答案 1 :(得分:0)

如果我理解正确,您正尝试发送POST请求以远程登录某个vBulletin用户,并且您希望使用他们的API来执行此操作。

所以问题是,你对此有何看法?

您是否希望收到一些确认数据并使用它来登录系统中的用户,或者您是否计划进行简单的远程呼叫?

即。你可以简单地做一个Ajax请求。

如果它更复杂并且您需要控制器中的API实例,我认为最好让您自己上课,这将使用curl将请求发送到他们的API。

相关问题