我有以下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 :(得分:1)
我找到了解决方案,我有两个curl_exec