HttpRequestPool::__construct
(PECL pecl_http:0.10.0-1.5.5)
HttpRequestPool::__construct — HttpRequestPool constructor
Описание
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.
Список параметров
- request
-
HttpRequest object to attach
Errors/Exceptions
Throws HttpRequestPoolException (HttpRequestException, HttpInvalidParamException).
Примеры
Пример #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;
}
?>
[an error occurred while processing the directive]
- Функция HttpRequestPool::attach() - Attach HttpRequest
- Функция HttpRequestPool::__construct() - HttpRequestPool constructor
- Функция HttpRequestPool::__destruct() - HttpRequestPool destructor
- Функция HttpRequestPool::detach() - Detach HttpRequest
- Функция HttpRequestPool::getAttachedRequests() - Get attached requests
- Функция HttpRequestPool::getFinishedRequests() - Get finished requests
- Функция HttpRequestPool::reset() - Reset request pool
- Функция HttpRequestPool::send() - Send all requests
- Функция HttpRequestPool::socketPerform() - Perform socket actions
- Функция HttpRequestPool::socketSelect() - Perform socket select
Коментарии
404 Not Found