Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Approach #1
- // While we're still active, execute curl
- $active = null;
- do {
- $mrc = curl_multi_exec($multi, $active);
- } while ($mrc == CURLM_CALL_MULTI_PERFORM);
- while ($active && $mrc == CURLM_OK) {
- // Wait for activity on any curl-connection
- if (curl_multi_select($multi) == -1) {
- continue;
- }
- // Continue to exec until curl is ready to give us more data
- do {
- $mrc = curl_multi_exec($multi, $active);
- } while ($mrc == CURLM_CALL_MULTI_PERFORM);
- }
- Approach #2
- //$running = null;
- //do {
- // curl_multi_exec($mh, $running);
- //} while ($running);
- do {
- $status = curl_multi_exec($mh, $active);
- if ($active) {
- curl_multi_select($mh);
- }
- }
- //while ($active && $status == CURLM_OK);
- while ($active && $mrc == CURLM_OK) {
- if (curl_multi_select($mh) == -1) {
- usleep(100); continue;
- }
- do {
- $mrc = curl_multi_exec($mh, $active);
- } while ($mrc == CURLM_CALL_MULTI_PERFORM);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement