Roberto Bahia
Roberto Bahia

Reputation: 105

Curl sending twice each request

I have the follow curl command.

It takes 7 seconds to run on my local server, I found too long, I see the server log and realized that the curl is sending twice each request

            $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);

Upvotes: 1

Views: 1582

Answers (1)

Roberto Bahia
Roberto Bahia

Reputation: 105

I found the solution I have two curl_exec

Upvotes: 1

Related Questions