php - how can i call two api's together at same time without waiting for response from first? -


i making search widget. when searching taking results 2 api's 1 yelp , other source. process taking longer time

$dataprovider = searchutil::locallookup($for, $near); //local api $content=searchutil::yelplookup($for,$near);    //yelp api $array=array_merge($dataprovider,$content); 

is there way can call both api's together? dont want yelp api called after first api gives result. want call both of them together.

is there way ?

it possible, have rewrite both locallookup , yelplookup , tie them both curl multi_exec context. curl, default, runs synchronously. in case, want async on multiple sets of data, , best way run both channels multi_exec context.

more info on page: http://php.net/manual/fr/function.curl-multi-exec.php .

once curl_multi_exec(), able track status of set of calls using second parameter (which reference-changed true or false), , there, you'll able content of each channel using curl_multi_getcontent().


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -