- example fixup
[m6w6/ext-http] / docs / examples / Parallel_Requests_.php
index e1eb88f52c6f3f27c519954cd084e5f4122431ad..8798c30f6b5680f92f85c3759bd7a65efc163882 100644 (file)
@@ -4,8 +4,8 @@ class Pool extends HttpRequestPool
        public function __construct()
        {
                parent::__construct(
-                       new HttpRequest('http://pear.php.net', HTTP_HEAD),
-                       new HttpRequest('http://pecl.php.net', HTTP_HEAD)
+                       new HttpRequest('http://pear.php.net', HTTP_METH_HEAD),
+                       new HttpRequest('http://pecl.php.net', HTTP_METH_HEAD)
                );
 
                // HttpRequestPool methods socketPerform() and socketSelect() are
@@ -13,7 +13,7 @@ class Pool extends HttpRequestPool
                // while the requests are being executed
                print "Executing requests";
                for ($i = 0; $this->socketPerform(); $i++) {
-                       $i % 3 or print ".";
+                       $i % 10 or print ".";
                        if (!$this->socketSelect()) {
                                throw new HttpException("Socket error!");
                        }
@@ -24,7 +24,7 @@ class Pool extends HttpRequestPool
 
 try {
        foreach (new Pool as $r) {
-               print "Checking ", $r->getUrl(), " reported ", $r->getResponseCode(), "\n";
+               echo "Checking ", $r->getUrl(), " reported ", $r->getResponseCode(), "\n";
        }
 } catch (HttpException $ex) {
        print $e;