Simon
Simon

Reputation: 394

Curl PHP requests in sequence

Is there a way I can be notified when a curl request completes? I'd like to start another request upon completion

    $curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'https://api.twitter.com/1/users/lookup.json?user_id='.$uids.'&include_entities=true');
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl_handle);
curl_close($curl_handle);

Upvotes: 0

Views: 1655

Answers (2)

MitziMeow
MitziMeow

Reputation: 665

cURL is "blocking" so when it's done you'll just move to the next line. Simply call another URL after $result = curl_exec($curl_handle);

Upvotes: 2

ajreal
ajreal

Reputation: 47331

You don't have to execute curl in asynchronous manner,
use curl_multi_exec to parellel running multiple curl
(if network bandwidth is not a constraint)

Upvotes: 0

Related Questions