-4

我想同时发送不同的网址。这是我使用的代码。你能告诉我这里的错误吗?

<?php
    $data = R::find('savedata','list_name = ? order by id desc',array($i));

    foreach ( $data as $list):
        $mh = curl_multi_init(); //set up a cURL multiple execution handle
        $ch = curl_init("https://example.com/save_data.php?NUM=$list->id&MSG=$message"); 
        curl_setopt($ch, CURLOPT_TIMEOUT, 2);           
        curl_multi_add_handle($mh, $ch); 
    endforeach; 

    curl_multi_exec($mh,);                          
    curl_multi_close($mh)
?>
4

1 回答 1

0

谢谢大家。我已自行更正此问题。我正在与您分享正确的代码,

$mobile = R::find('add_numbers', 'list_name = ? order by id desc', array($i));

foreach ($mobile as $list):
    try{
  $url = "https://example.com/save_data.php?NUM=$list->id&MSG=****";
    $ch = curl_init($url);

   curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // TRUE
   curl_setopt($ch, CURLOPT_HEADER, 0); // DO NOT RETURN HTTP HEADERS
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // RETURN THE CONTENTS OF THE CALL
   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
   $results = curl_exec($ch);
     $i[]=$results;
    }
于 2013-08-26T08:43:29.110 回答