Using curl and PHP to talk to a REST service
Monday, September 15. 2008
Good post Lorna!
Lineke also has a blog post on multithreading in PHP with the curl extension which might be useful to people who want to build a high performance layer on top of a REST service: http://www.ibuildings.com/blog/archives/811-Multithreading-in-PHP-with-CURL.html.
One day I should write a blog post about how I used that…
Boy: Thanks for dropping by and pointing at Lineke’s post, that’s a great addition (and I hadn’t seen it). You should definitely blog about your usage of that, I’d be really interested.
Great post as always Lorna! That said, I hate cURL. :P I think it’s a great way for people still running PHP pre-5 to get things done.
For 5 and on and for what you’re using in this particular example, the HTTP streams wrapper. Check out Example #1 here: http://php.net/manual/en/context.http.php.
If you need all the functionality that cURL provides with a bit less code, pecl_http is great: http://pecl.php.net/package/pecl_http.
Robert: Glad to help!
Matthew: How funny, I absolutely love curl, its a clean protocol and widely used. That said, I think I need to come to terms with my own command-line-geekery some day soon…
Thanks for this very simple, straightforward and easy-to-follow sample plus explanation.
Just what the doctor ordered! Please, keep up the good work.
WebGyver: Thanks for dropping in and for your kind words :)

