2015-04-02 96 views
0

我有以下curl命令。發送兩次請求的捲髮

需要7秒鐘,我的本地服務器上運行,我發現時間太長,我看到服務器日誌,並意識到捲曲每個請求

  $url = "http://192.168.0.106:8080/v1/devices/$deviceID/d0status/?access_token=$dispositivo"; 
      // Initiate curl 
      $ch2 = curl_init(); 
      // Disable SSL verification 
      curl_setopt($ch2, CURLOPT_SSL_VERIFYPEER, false); 
      // Will return the response, if false it print the response 
      curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true); 
      // Set the url 
      curl_setopt($ch2, CURLOPT_URL,$url); 
      curl_setopt($ch, CURLOPT_POST, true);//envia informação 
      curl_setopt($ch, CURLOPT_POSTFIELDS, array('params' => 'l1,HIGH'));//desliga tomada 
      curl_setopt($ch2, CURLOPT_TIMEOUT_MS, 1000);// 
      $result2=curl_exec($ch2); 
      curl_exec($ch2); 
      // Closing 
      curl_close($ch2); 

回答

0

我找到了解決辦法發送兩次,我有兩個curl_exec