Jump to content

Edit History

Hamendra Sunthwal

Hamendra Sunthwal

I am trying to send 200 orders to an api using curl but timeout occurs

Curl api error: Operation timed out after 1000 milliseconds with 0 bytes received

Here is the code i am using

$ch = curl_init();
                curl_setopt($ch, CURLOPT_URL, "http://api-r1.smartfreight.com/api/soap/classic");
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                curl_setopt($ch, CURLOPT_USERPWD, "[email protected]:World#10");
                curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
                curl_setopt($ch, CURLOPT_POST, true);
                curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
                curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml; charset=utf-8", "soapAction: http://www.smartfreight.com/online/SFOv1/Import", "Content-Length: " . strlen($data)));
                curl_setopt($ch, CURLOPT_TIMEOUT,5000);
                $output = curl_exec($ch);
    
                //~ if($output === false && curl_errno($ch) == CURLE_OPERATION_TIMEOUTED){
                    //~ continue;
                //~ }else 
                if($output === false){
                    echo "\nCurl api error: ".curl_error($ch);
                }

is there any quick fix for this issue ?

Thankyou

Hamendra Sunthwal

Hamendra Sunthwal

I am trying to send 200 orders to an api using curl but timeout occurs

Curl api error: Operation timed out after 1000 milliseconds with 0 bytes received

Here is the code i am using

$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://api-r1.smartfreight.com/api/soap/classic"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, "[email protected]:World#10"); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml; charset=utf-8", "soapAction: http://www.smartfreight.com/online/SFOv1/Import", "Content-Length: " . strlen($data))); curl_setopt($ch, CURLOPT_TIMEOUT,5000); $output = curl_exec($ch); //~ if($output === false && curl_errno($ch) == CURLE_OPERATION_TIMEOUTED){ //~ continue; //~ }else if($output === false){ echo "\nCurl api error: ".curl_error($ch); }

is there any quick fix for this issue ?

Thankyou

×
×
  • Create New...