How to use curl_multi_add_handle() to add cURL handle to a cURL multi handle in PHP

1 Answer

0 votes
$curl1 = curl_init();
$curl2 = curl_init();

curl_setopt($curl1, CURLOPT_URL, "http://www.webshopy.com/");
curl_setopt($curl1, CURLOPT_HEADER, 0);
curl_setopt($curl2, CURLOPT_URL, "http://www.seek4info.com/");
curl_setopt($curl2, CURLOPT_HEADER, 0);

$cum = curl_multi_init();

curl_multi_add_handle($cum, $curl1);
curl_multi_add_handle($cum, $curl2);

$ex = null;

do {
    curl_multi_exec($cum, $ex);
} while($ex > 0);


curl_multi_remove_handle($cum, $curl1);
curl_multi_remove_handle($cum, $curl2);
curl_multi_close($cum);


/*
run: 

check your browser 

*/

 



answered Jun 7, 2016 by avibootz
edited Jun 8, 2016 by avibootz

Related questions

1 answer 148 views
1 answer 172 views
1 answer 166 views
166 views asked Oct 20, 2020 by avibootz
1 answer 267 views
1 answer 23,968 views
1 answer 192 views
...