Reputation: 11
I fetch some data from the remote server and feed it into my site database .It has 900k of records(app) but the insertion of records stopped 60,180 records only. We use mailto
and an exception handler to find the bugs but no response.
Can anyone offer advice on how to get the cron timeout or do we have an error in code our code?
<?php
set_time_limit(0);
ignore_user_abort();
try
{
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://ks329xxx.com/cronRU/update");
curl_setopt($ch, CURLOPT_HEADER, 0);
// grab URL and pass it to the browser
curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);
}
catch (Exception $e)
{
echo 'Caught exception: ', $e->getMessage(), "\n";
mail('[email protected]', 'update', $message);
}
?>
Upvotes: 1
Views: 175
Reputation: 173562
You're not checking for the result of curl_exec()
:
if (curl_exec($ch) === false) {
throw new Exception(curl_error($ch));
}
Upvotes: 1