2012-11-28 2 views

답변

0

당신은 개별 자원과 함께 데이터를 유지해야한다 :

$handles = array(); 
foreach ($urls as $url) { 
    $ch = curl_init($url); 
    $data = 'whatever'; 
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 

    $handles[$url] = array(
     'ch' => $ch, 
     'data' => $data, 
    ); 
} 

이 나중에 검사하는 데 사용할 수있는 단일 구조로 함께 컬 핸들 및 데이터를 유지합니다.

foreach($handles as $url => $data) { 
    // $url is the page you requested for this particular handle 
    // $data['data'] contains the data that goes with it 
    $body = curl_multi_getcontent($data['ch']); 
    curl_multi_remove_handle($mh, $data['ch']); 
    curl_close($data['ch']); 
}