For previous projects I have used
/**
* HTTP Class
*
* This is a wrapper HTTP class that uses either cURL or fsockopen to
* harvest resources from web. This can be used with scripts that need
* a way to communicate with various APIs who support REST.
*
* @author Md Emran Hasan <[email protected]>
* @package HTTP Library
* @copyright 2007-2008 Md Emran Hasan
* @link http://www.phpfour.com/lib/http
* @since Version 0.1
*/
This works very well but does not appear to have been updated in quite some time (indeed, the link above does not even work now...).
My latest project is going to make heavy use of http methods (accessing cross domain and internal APIs) so I need to make sure I am using as efficient an http class/library as possible.
What do you use for this functionality?
PHP has a native HTTP class in PECL:
The HTTP extension eases handling of HTTP URLs, dates, redirects, headers and messages in a HTTP context (both incoming and outgoing). It also provides means for client negotiation of preferred language and charset, as well as a convenient way to exchange arbitrary data with caching and resuming capabilities.
Also provided is a powerful request and parallel interface (PHP5+), if the extension is built with cURL support.
In addition, most PHP functions able to work with remote resources can be used with custom Stream Contexts, which will allow you to configure how PHP connects to resources.
I typically use Zend_Http_Client
unless im working in a Symfony project - in that case i use sfWebBrowserPlugin
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With