How do you normally do a POST to an API in PHP?
For example:
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.
See here: https://www.vbulletin.com/forum/content.php/365-User-Related-Methods
More here: https://www.vbulletin.com/forum/content.php/334-mobile-api
So how would I do a POST to the API if the API script is located at http://somedomain.com/api.php ?
If I set the FORM ACTION to the external API page, it will send the user to that external site, so that obviously can’t be the correct way.
Would I have to do a cURL POST? But that seems complicated for a simple API call.
Or do API’s normally understand POST requests in a different and more straightforward manner?
Found the answer I was looking for:
http://code.google.com/apis/chart/image/docs/post_requests.html
See under “Using PHP for a POST Request”.
Very straightforward and it worked.