Created
August 12, 2013 19:53
-
-
Save m6w6/6214488 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$client = new http\Client; | |
for ($i = 1; $i < $argc; ++$i) { | |
$client->enqueue($req = new http\Client\Request("GET", $argv[$i]), | |
function ($res) use ($req, &$state) { | |
$state = ""; | |
printf("\n%d < %s\n", $res->getResponseCode(), $req->getRequestUrl()); | |
// auto-dequeue | |
return true; | |
} | |
); | |
} | |
while ($client->once()) { | |
printf("\r... doing some other work%s", $state .= "."); | |
$client->wait(1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment