I'm building a REST web service client in PHP and at the moment I'm using curl to make requests to the service.
How do I use curl to make authenticated (http basic) requests? Do I have to add the headers myself?
I'm building a REST web service client in PHP and at the moment I'm using curl to make requests to the service.
How do I use curl to make authenticated (http basic) requests? Do I have to add the headers myself?
If the authorization type is Basic auth and data posted is json then do like this
There are multiple REST frameworks out there. I would strongly recommend looking into Slim mini Framework for PHP
Here is a list of others.
Yahoo has a tutorial on making calls to their REST services using PHP:
Make Yahoo! Web Service REST Calls with PHP
I have not used it myself, but Yahoo is Yahoo and should guarantee for at least some level of quality. They don't seem to cover PUT and DELETE requests, though.
Also, the User Contributed Notes to curl_exec() and others contain lots of good information.