Вопрос по мульткурлу

Discussion in 'PHP' started by Krist_ALL, 22 Nov 2009.

  1. Krist_ALL

    Krist_ALL Banned

    Joined:
    14 Jan 2009
    Messages:
    436
    Likes Received:
    193
    Reputations:
    24
    Юзаю мультикурл и мне нада получить html код страницы, чтобы отпарсить его но в ответ какието 0 и -1


    PHP:
       //создаем обработчик для параллельной работы с URL'ами
            
    $mh curl_multi_init();
            
    //создаем обработчики для каждого отдельного URL и добавляем их в $mh
            
    $handles = array();
            for (
    $i 0$i count($adresa); $i++) {
                
    $handles[$i] = curl_init();
                
    curl_setopt($handles[$i], CURLOPT_URL$adresa[$i]);
                
    curl_setopt($handles[$i], CURLOPT_RETURNTRANSFER1);
              
    //  curl_setopt($handles[$i], CURLOPT_FOLLOWLOCATION, 1);
                
    curl_setopt($handles[$i], CURLOPT_TIMEOUT6);
                
    curl_setopt($handles[$i], CURLOPT_HEADER1);
                 
    curl_setopt($handles[$i], CURLOPT_USERAGENT'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3');
                   
    curl_setopt($handles[$i], CURLOPT_REFERER'http://google.com');
                    
    curl_setopt($handles[$i], CURLOPT_POST1);
                     
    curl_setopt($handles[$i], CURLOPT_POSTFIELDS"...........................");



        
    curl_multi_add_handle($mh$handles[$i]);
            }


     
    $running null;
            do {
             
    $result =    curl_multi_exec($mh$running);
            
            echo 
    htmlspecialchars($result);
            } while (
    $running 0);


     
    //закрываем обработчики
            
    for ($i 0$i count($handles); $i++) {
                
    curl_multi_remove_handle($mh$handles[$i]);
            }
     
  2. Krist_ALL

    Krist_ALL Banned

    Joined:
    14 Jan 2009
    Messages:
    436
    Likes Received:
    193
    Reputations:
    24
    Выводит