I fetch some data from the remote server and feed it into my site database .It having 9 lakhs of records(app) but the insertion of records stopped 60,180 records only.we use mailto function and exception handler to find the bugs but no response.Anyone please advice me whether the cron get timeout or we have error in code our code is

<?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('varunxxxx@xxxxx.com', 'update', $message);    
}
?>

Recommended Answers

All 4 Replies

Member Avatar for diafol

<off topic>

I'm assuming 9 lakh = 900,000

Stick to international amounts, lakh is a bit obscure.

One thing I notice is $message is undefined (line 19). Am not so sure though, that curl raises exceptions on errors.

now i fix that $message = $e->getMessage(); There is no problem with the code . its working when am fetching minimum amount of data. when go for mass data its get terminated . I set infinite time for execution in web server but It seems to be a same issue. Kindly please advice and share your ideas

I set infinite time for execution in web server

Are you sure your host actually supports this? For security/performance reasons this is usually disabled.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.