Skip to content

Instantly share code, notes, and snippets.

View chienlvneoscorp's full-sized avatar

chienlvneoscorp

View GitHub Profile
@jacksontong
jacksontong / guzzle.php
Last active June 8, 2018 03:03
Guzzle async example
<?php
require_once('vendor/autoload.php');
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Promise as GuzzlePromise;
//https://stackoverflow.com/a/32751004/3787302
$start_time = microtime(TRUE);
$client = new GuzzleClient(['timeout' => 12.0]); // see how i set a timeout
$requestPromises = [];
$sitesArray = [