小编Phe*_*Dev的帖子

curl_errno返回0而不是6

$data_struct = array(); 

$data_struct[]['opts'] = array( CURLOPT_URL => 'http://www.yahoo.com/', CURLOPT_RETURNTRANSFER => true);
$data_struct[]['opts'] = array( CURLOPT_URL => 'http://www.google.com/', CURLOPT_RETURNTRANSFER => true);
$data_struct[]['opts'] = array( CURLOPT_URL => 'http://404.php.net/', CURLOPT_RETURNTRANSFER => true);

//create the multiple cURL handle
$mh = curl_multi_init();

// create and add handles to data structure
foreach ($data_struct as $i => $data){
   $data_struct[$i]['handle'] = curl_init();
   curl_setopt_array($data_struct[$i]['handle'], $data_struct[$i]['opts']);
   curl_multi_add_handle($mh, $data_struct[$i]['handle']);
}  

$active = null;
//execute the handles
do {
    $mrc = curl_multi_exec($mh, $active);    

} while ($mrc == CURLM_CALL_MULTI_PERFORM);

while ($active && …
Run Code Online (Sandbox Code Playgroud)

php curl libcurl curl-multi

6
推荐指数
1
解决办法
5895
查看次数

标签 统计

curl ×1

curl-multi ×1

libcurl ×1

php ×1