X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=docs%2Ffunctions.html;h=92a14ca2eea4463d0187c7ef2a67dc72ef88872c;hb=64b8eb68455c36e7e153014deaf52a6f9d2de39c;hp=a1f90247bd8e14596b98abde42fb5b7a1b11710b;hpb=a84e2e5f8fa39386883754b6ab8bcd7fbfb5ed94;p=m6w6%2Fext-http diff --git a/docs/functions.html b/docs/functions.html index a1f9024..92a14ca 100644 --- a/docs/functions.html +++ b/docs/functions.html @@ -492,8 +492,41 @@ GET example:




+

HttpRequestPool

+

void HttpRequestPool::__construct()

+

Instantiate a new HttpRequestPool object. An HttpRequestPool is
+able to send several HttpRequests in parallel.
+
+Example:


+<?php
    $urls
= array('www.php.net', 'pecl.php.net', 'pear.php.net')
    
$pool = new HttpRequestPool;
    foreach (
$urls as $url) {
        
$req[$url] = new HttpRequest("http://$url", HTTP_HEAD);
        
$pool->attach($req[$url]);
    }
    
$pool->send();
    foreach (
$urls as $url) {
        
printf("%s (%s) is %s\n",
            
$url, $req[$url]->getResponseInfo('effective_url'),
            
$r->getResponseCode() == 200 ? 'alive' : 'not alive'
        
);
    }
?>
+

+

+
+

+

void HttpRequestPool::__destruct()

+

Clean up HttpRequestPool object.

+

void HttpRequestPool::reset()

+

Detach all attached HttpRequest objects.

+

bool HttpRequestPool::attach(HttpRequest request)

+

Attach an HttpRequest object to this HttpRequestPool.
+NOTE: set all options prior attaching!

+

bool HttpRequestPool::detach(HttpRequest request)

+

Detach an HttpRequest object from this HttpRequestPool.

+

bool HttpRequestPool::send()

+

Send all attached HttpRequest objects in parallel.

+

protected bool HttpRequestPool::socketSend()

+

Usage:


+<?php
    
while ($pool->socketSend()) {
        
do_something_else();
        if (!
$pool->socketSelect()) {
            die(
'Socket error');
        }
    }
    
$pool->socketRead();
?>
+

+

+
+

+

protected bool HttpRequestPool::socketSelect()

+

See HttpRequestPool::socketSend().

+

protected void HttpRequestPool::socketRead()

+

See HttpRequestPool::socketSend().


-

Generated at: Mon, 6 Jun 2005 13:44:11 +0200

+

Generated at: Tue, 14 Jun 2005 16:56:52 +0200