andrewdps Posted September 23, 2010 Share Posted September 23, 2010 Hi, I've a problem modifying the code which send parallel requests to get the status from getstatuses().I've two functions say public function getStatuses($idList) { } public function getid($id) { $status = array(); foreach ($id as $idList) { $status[] = $this->getStatuses($idList); } return $status; } the above getid() function sends the synchronous requests to the getstatuses() function and get the status back one after another.If you need to make 5 HTTP requests and each call takes a second, your app is delayed at least 5 seconds.Now,i want to rewrite the code(if possible two functions)that speeds up the results by sending all the requests and getting back the statuses at once.Something,other friends have developed is to reverse the getstatuses() and getid() functionality.Can anybody help me writing this code Thanks Quote Link to comment Share on other sites More sharing options...
btherl Posted September 23, 2010 Share Posted September 23, 2010 There's a curl multi interface for php: http://www.php.net/manual/en/function.curl-multi-add-handle.php It's a bit experimental and light on the documentation however. I had to refer back to the libcurl documentation to work out how the php interface was supposed to be used. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.