From c4d95e923b40160d814c7e4e0a822332bbd65bdb Mon Sep 17 00:00:00 2001
From: Michael Wallner
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'
);
}
?>
+<?php
try {
$pool = new HttpRequestPool(
new HttpRequest('http://www.google.com/', HTTP_HEAD),
new HttpRequest('http://www.php.net/', HTTP_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;
}
?>
@@ -457,6 +457,16 @@ NOTE: set all options prior attaching!See HttpRequestPool::socketSend().
protected void HttpRequestPool::socketRead()
See HttpRequestPool::socketSend().
+bool HttpRequestPool::valid()
+Implements Iterator::valid().
+HttpRequest HttpRequestPool::current()
+Implements Iterator::current().
+long HttpRequestPool::key()
+Implements Iterator::key().
+void HttpRequestPool::next()
+Implements Iterator::next().
+void HttpRequestPool::rewind()
+Implements Iterator::rewind().
http_response_object.c
static bool HttpResponse::setCache(bool cache)
@@ -531,7 +541,7 @@ Example:
-Generated at: Fri, 22 Jul 2005 17:44:59 +0200
+Generated at: Mon, 25 Jul 2005 14:47:50 +0200