HttpRequestPool クラス
PHP Manual

HttpRequestPool::__construct

(PECL pecl_http >= 0.10.0)

HttpRequestPool::__constructHttpRequestPool のコンストラクタ

説明

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

新しい HttpRequestPool オブジェクトのインスタンスを作成します。 HttpRequestPool は、複数の HttpRequest を平行して送信することができます。

事実上無限にオプションのパラメータを指定することができます。 各パラメータは HttpRequest オブジェクトへの参照です。

パラメータ

request

アタッチする HttpRequest オブジェクト。

エラー / 例外

HttpRequestPoolException (HttpRequestException、HttpInvalidParamException) をスローします。

例1 HttpRequestPool の例

<?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;
}
?>


HttpRequestPool クラス
PHP Manual
アダルトレンタルサーバー