Hi all
First post yipee!
See if you can help me....
I am currently writing a PHP application that talks to an API for logging in, account management etc.
The API accepts a POST request and generates a plain text, name/value pair response like this:
status=ok
username=bob
last-login=01.01.2000
etc....
How can I send and read the response using PHP?
Can someone point me in the right direction for sending the request and parsing the responses?
Any help appreciated
Cheers
Sending and receiving HTTP responses
Moderator: General Moderators
-
nowaydown1
- Forum Contributor
- Posts: 169
- Joined: Sun Apr 27, 2008 1:22 am
Re: Sending and receiving HTTP responses
Hi Crisp,
Welcome to the forum. There's a few different approaches for this kind of thing. My recommendation would be to have a look at the CURL library (http://us3.php.net/manual/en/function.curl-init.php). It can construct POST requests. The library is primarily used for posting data to / getting data from remote websites.
For what you're trying to do you'll probably have to have a few curl_setopt() calls, but the manual has info on that too.
(http://us.php.net/curl_setopt)
Good luck!
Welcome to the forum. There's a few different approaches for this kind of thing. My recommendation would be to have a look at the CURL library (http://us3.php.net/manual/en/function.curl-init.php). It can construct POST requests. The library is primarily used for posting data to / getting data from remote websites.
For what you're trying to do you'll probably have to have a few curl_setopt() calls, but the manual has info on that too.
(http://us.php.net/curl_setopt)
Good luck!
Re: Sending and receiving HTTP responses
Thanks nowaydown1
Appreciate the response.
I'll give it a go.

Appreciate the response.
I'll give it a go.