Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $siteList= 'http://www.google.com - http://www.google.com';
- $sites = explode(' - ', $siteList);
- $mh = curl_multi_init();
- $handles = array();
- foreach($sites as $k => $v) {
- $ch{$k} = curl_init($url);
- curl_setopt($ch{$k}, CURLOPT_URL, $v);
- curl_setopt($ch{$k}, CURLOPT_HEADER, 0);
- $handles[$k] = $ch{$k};
- }
- foreach($handles as $k => $v) {
- curl_multi_add_handle($mh, $v);
- }
- $active = null;
- do {
- $mrc = curl_multi_exec($mh, $active);
- } while($mrc == CURLM_CALL_MULTI_PERFORM);
- while($active && $mrc == CURLM_OK) {
- if(curl_multi_select($mh) != -1) {
- do {
- $mrc = curl_multi_exec($mh, $active);
- } while($mrc == CURLM_CALL_MULTI_PERFORM);
- }
- }
- var_dump($mh);
- foreach($handles as $k => $v) {
- curl_multi_remove_handle($mh, $v);
- }
- curl_multi_close($mh);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement