Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once(realpath(__DIR__).'/../vendor/autoload.php');
- $reactor = Amp\reactor();
- $client = new \Amp\Artax\Client($reactor);
- $client->setOption(\Amp\Artax\Client::OP_MS_KEEP_ALIVE_TIMEOUT, 3000);
- $callbackTime = null;
- $callback = function () use (&$callbackTime) {
- echo "I r callback!!\n";
- $callbackTime = microtime(true);
- };
- $promise = $client->request("http://www.bing.com/asdasdasdsd");
- $promise->when($callback);
- echo "Running reactor: \n";
- $reactor->run();
- $elapsed = microtime(true) - $callbackTime;
- printf("elapsed: %5.2f\n", $elapsed);
- echo "Fin.";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement