protected static function curl_multi_exec($urls)
    {
        $nodes = [];
        /* @var $url CurlTrait */
        foreach ($urls as $url) {
            $ch = curl_init();
            $nodes[] = ['ch' => $ch, 'url' => $url];

            curl_setopt_array($ch, $url->getOptions());
        }

        $mh = curl_multi_init();
        foreach ($nodes as $node) {
            curl_multi_add_handle($mh, $node['ch']);
        }

        //execute the handles
        do {
            curl_multi_exec($mh, $running);
            curl_multi_select($mh);
        } while ($running > 0);

        foreach ($nodes as $node) {
            /* @var $url Curl */
            $url = $node['url'];

            $ch = $node['ch'];

            $url->_content = curl_multi_getcontent($ch);

            $url->_errorCode = curl_errno($ch);
            if (!empty($url->_errorCode)) {
                $url->_errorMessage = curl_error($ch);
            }
            $url->_info = curl_getinfo($ch);
        }

        //close the handles
        foreach ($nodes as $node) {
            curl_multi_remove_handle($mh, $node['ch']);
        }
        curl_multi_close($mh);
    }
protected static function curl_multi_exec($urls)
    {
        $nodes = [];
        /* @var $url CurlTrait */
        foreach ($urls as $url) {
            $ch = curl_init();
            $nodes[] = ['ch' => $ch, 'url' => $url];

            curl_setopt_array($ch, $url->getOptions());
        }

        $mh = curl_multi_init();
        foreach ($nodes as $node) {
            curl_multi_add_handle($mh, $node['ch']);
        }

        //execute the handles
        do {
            curl_multi_exec($mh, $running);
            curl_multi_select($mh);
        } while ($running > 0);

        foreach ($nodes as $node) {
            /* @var $url Curl */
            $url = $node['url'];

            $ch = $node['ch'];

            $url->_content = curl_multi_getcontent($ch);

            $url->_errorCode = curl_errno($ch);
            if (!empty($url->_errorCode)) {
                $url->_errorMessage = curl_error($ch);
            }
            $url->_info = curl_getinfo($ch);
        }

        //close the handles
        foreach ($nodes as $node) {
            curl_multi_remove_handle($mh, $node['ch']);
        }
        curl_multi_close($mh);
    }
protected static function curl_multi_exec ( $ urls ) { $ nodes = [ ] ; /* @var $url CurlTrait */ foreach ( $ urls as $ url ) { $ ch = curl_init ( ) ; $ nodes [ ] = [ 'ch' => $ ch , 'url' => $ url ] ; curl_setopt_array ( $ ch , $ url -> getOptions ( ) ) ; } $ mh = curl_multi_init ( ) ; foreach ( $ nodes as $ node ) { curl_multi_add_handle ( $ mh , $ node [ 'ch' ] ) ; } //execute the handles
 do { curl_multi_exec ( $ mh , $ running ) ; curl_multi_select ( $ mh ) ; } while ( $ running > 0 ) ; foreach ( $ nodes as $ node ) { /* @var $url Curl */ $ url = $ node [ 'url' ] ; $ ch = $ node [ 'ch' ] ; $ url -> _content = curl_multi_getcontent ( $ ch ) ; $ url -> _errorCode = curl_errno ( $ ch ) ; if ( ! empty ( $ url -> _errorCode ) ) { $ url -> _errorMessage = curl_error ( $ ch ) ; } $ url -> _info = curl_getinfo ( $ ch ) ; } //close the handles
 foreach ( $ nodes as $ node ) { curl_multi_remove_handle ( $ mh , $ node [ 'ch' ] ) ; } curl_multi_close ( $ mh ) ; }
Executes parallels curls
@param CurlTrait[] $urls
Executes parallels curls