php - Multiple API requests with OVH API wrapper -
i trying create web interface interact ovh's api using official php wrapper.
first ip list :
$ips = $ovh->get('/ip');
but then, each ip address want related informations , put in table, :
foreach ($ips $ip) { $ip_infos = $ovh->get('/ip/' . $ip_api); }
it works, each call, have wait previous 1 come back. takes 30~40sec load full page because of ~100 ip.
is there way send 1 big request instead of many little ones ovh php wrapper ? or maybe multithreading ? speed requests.
unless php engine build "zts" (zend thread safety) , have pthread extension installed, can not achieved using official php wrapper. if using plain php mandatory, may patch wrapper use curl multi. see http://www.phpied.com/simultaneuos-http-requests-in-php-with-curl/ example.
another way use hybrid approach using client side js.
- the php returns page list of ips
- the js requests ips details asynchronously
this trigger multiple parallel requests , improve user experience. actually, ovh customer interface under hood.
Comments
Post a Comment