PHP Doku:: HttpRequestPool constructor - function.httprequestpool-construct.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzSonstige DiensteHTTPThe HttpRequestPool classHttpRequestPool::__construct

Ein Service von Reinhard Neidl - Webprogrammierung.

The HttpRequestPool class

<<HttpRequestPool::attach

HttpRequestPool::__destruct>>

HttpRequestPool::__construct

(PECL pecl_http >= 0.10.0)

HttpRequestPool::__constructHttpRequestPool constructor

Beschreibung

void HttpRequestPool::__construct ([ HttpRequest $request ] )

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

Accepts virtually infinite optional parameters each referencing an HttpRequest object.

Parameter-Liste

request

HttpRequest object to attach

Fehler/Exceptions

Throws HttpRequestPoolException (HttpRequestException, HttpInvalidParamException).

Beispiele

Beispiel #1 A HttpRequestPool example

<?php
try {
    
$pool = new HttpRequestPool(
        new 
HttpRequest('http://www.google.com/'HttpRequest::METH_HEAD),
        new 
HttpRequest('http://www.php.net/'HttpRequest::METH_HEAD)
    );
    
$pool->send();
    foreach(
$pool as $request) {
        
printf("%s is %s (%d)\n",
            
$request->getUrl(),
            
$request->getResponseCode() ? 'alive' 'not alive',
            
$request->getResponseCode()
        );
    }
} catch (
HttpException $e) {
    echo 
$e;
}
?>


Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)