[wp-hackers] WP HTTP Client

Jacob Santos wordpress at santosj.name
Sun Sep 7 21:51:03 GMT 2008


Matt wrote:
> On Sun, Sep 7, 2008 at 12:09 PM, Jacob Santos <wordpress at santosj.name> wrote:
>   
>> The new http.php supports the HTTP PHP extension, the cURL PHP extension,
>> Streams (fopen), Sockets (Fopen), and fsockopen. It is supported on PHP4 and
>> PHP5. You can install the HTTP extension on PHP4 and it will be used.
>>     
>
> So, if those are all available, which one will it use?
>   
Well, I accidentally listed them in the order they will be used. I 
should say the first one that is available to be working will be used, 
however there is a different list for POST and GET. The POST list is 
smaller, because not all of the transports supports sending content to 
the requested server. That is HTTP, Streams, and fsockopen will be used, 
in that order, to send requests that have a body. I'm sure cURL can be 
used, but haven't yet found a way that matches the other transports.

I suggest installing the HTTP PHP extension (very easy to install using 
PECL), one because it has worked better than any of the others and is 
supported on PHP4 and PHP5. When it gets down to Streams, Sockets, and 
fsockopen, then it gets a little more difficult to say if the request 
will be reliable. That and the fsockopen has the most code need to 
support the features the other support natively, so it is slower and 
venerable to bugs.

The HTTP extension pretty much does everything, so the level of 
abstraction is almost nonexistent compared to the others.

Jacob Santos


More information about the wp-hackers mailing list