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.

  1. the php returns page list of ips
  2. the js requests ips details asynchronously

this trigger multiple parallel requests , improve user experience. actually, ovh customer interface under hood.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -