Skip to content

Instantly share code, notes, and snippets.

@m6w6
Created August 12, 2013 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m6w6/6214488 to your computer and use it in GitHub Desktop.
Save m6w6/6214488 to your computer and use it in GitHub Desktop.
<?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