I am trying the following Curl related code which works fine for 800+ orders but fails suddenly without any response.
//PERFORM POST REQUEST
$post_json = json_encode($order);
$endpoint = 'https://api.hubapi.com/deals/v1/deal';
$ch = @curl_init();
@curl_setopt($ch, CURLOPT_POST, true);
@curl_setopt($ch, CURLOPT_POSTFIELDS, $post_json);
@curl_setopt($ch, CURLOPT_URL, $endpoint);
@curl_setopt($ch, CURLOPT_TIMEOUT,15);
@curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
@curl_setopt($ch, CURLOPT_NOSIGNAL, 1);
@curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
"Authorization: Bearer " . $this->access_token
));
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$this->log("1");
$response = @curl_exec($ch);
$this->log("2");
$status_code = @curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curl_errors = curl_error($ch);
@curl_close($ch);
The issue I am facing currently is that, Order Sync stops abruptly after sometime while CREATING NEW Orders to Hubspot API from Shopware 5.
It always stops in a CURL request. There is no response at all from the curl_exec() statement.
$response = @curl_exec($ch);
The code does not move ahead of that line.
$this->log("1");
$response = @curl_exec($ch);
$this->log("2");
So in the code above “1” is printed, but “2” is not printed in the case when there is an issue.
The order sync does process around 800+ order everytime.
The sync doesn’t fail at any particular order, it stops at random orders.
Mostly it stops somewhere after 15- 20 minutes of run.
We have tried several debugging techniques but nothing seems to be working as if now.
We have tried Cron parameters and PHP settings.
--
Have modified PHP.ini file to set max execution time to a large value of 1 hour. But Have not restart PHP from pleask.
Have used these two in PHP code:
set_time_limit(0);
ignore_user_abort(true);
curl settings tried are:
@curl_setopt($ch, CURLOPT_TIMEOUT,15);
@curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
@curl_setopt($ch, CURLOPT_NOSIGNAL, 1);
Please help.