parallel
parallel copied to clipboard
php7.2.34-ts parallel=1.1.4 Call to undefined method parallel\\Runtime\\Type\\Unavailable::request()
use Illuminate\Http\Request; use GuzzleHttp\Client; use parallel\Runtime;
$urls = array(
'https://www.example.com',
'https://www.google.com',
'https://www.facebook.com',
'https://www.github.com',
'https://www.stackoverflow.com',
);
$client1 = new \GuzzleHttp\Client();
$runtime = new Runtime();
$promises = array();
foreach ($urls as $url) {
$promises[] = $runtime->run(function ($url) use ($client1) {
var_dump($client1->request('',$url));
}, [$url]);
}
$results = array();
foreach ($promises as $promise) {
$results[] = $promise->value();
}