When I'm trying to send data on a API using CURL. API taking long time (10 minute or more) to the execution and at the end API successfully executed on its destination. but After the 10 minute, curl not returning any response.
But same process are complete in under the 5 minutes, then everything is working fine.
Here is my code
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt_array($ch, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "postvar1=value1",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/x-www-form-urlencoded",
),
));
$api_res = curl_exec($ch);
$err = curl_error($ch);
curl_close($ch);
$api_obj = json_decode($api_res, true);
Please suggest me the better solution for successfully run this script after 10 minute or more time.