PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTTP » HTTP_Request2 » Bug #5022

Non-Blocking Requests not support

Details

Request #5022Non-Blocking Requests not support
Submitted2005-08-07 19:07 UTC
Frommisc at keilonat dot de
StatusOpen
PackageHTTP_Request2
PHP Version4.4.0
OSWindows 2000
Roadmaps(Not assigned)

Comments

[2005-08-07 19:07 UTC] misc at keilonat dot de

Description:
------------
Because HTTP_Request::sendRequest() does not only send the request as the name would suggest, but also fetches the data immediately, it is not possible to use this class nor classes based on this (e.g. HTTP_Client) to perform non-blocking (parallel) requests which is very pity.

To perform non-blocking requests, one would have to do something like this:

<?php
$urls = array(
'http://pear.php.net',
'http://php.net',
'http://google.de'
);

// only open socket and send request,
// no fetching of data or headers!
foreach($urls as $url) {
$requests[$url] =& new HTTP_Request($url);
$requests[$url]->sendRequest();
}

// retrieval of data
foreach($urls as $url) {
$data = $requests[$url]->fetchData();
}
?>

If the data is fetched immediately after the request, the effect of socket_set_blocking($fp, 0) is zilch.