Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 791303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:48:49+00:00 2026-05-14T21:48:49+00:00

I am currently using CURL via a php script running as daily cron to

  • 0

I am currently using CURL via a php script running as daily cron to export product data in csv format from a site’s admin area.

The normal way of exporting data will be to go to the Export page in a browser, and set the configuration, then click on “export data” button. But as the number of products I am exporting is very large, and it takes more than 5-10 mins to export the data, I’ve decided to use php’s curl function to mimic this on a daily basis via cron.

Previously, it is working fine, but recently as I increased the number of products in the store by 500+, the script fails to return the exported data. Testing it manually via clicking on the “export” button in a browser, does return the data correctly. Thus there is no “timeout” issue with running the export in a browser manually.

I’ve tested and by removing/decreasing the number of products (thus the time needed), the php-curl script works fine again when run from cron.

So I suspect that it has something to do with timeouts issue, specifically with the curl function in php.

I’ve set both CURLOPT_TIMEOUT and CURLOPT_CONNECTTIMEOUT to ‘0’ respectively to try.
In the php-curl script, I’ve also set “set_time_limit(3000)”. But still it does not work, and the request will timeout, with the script failing to return with a complete set of csv data.

Any help in helping me resolve/understand this issue will be much appreciated!

Edited: Added part of the code where the curl script is calling the export function.

$interface = new StoreInterface(); 
echo "Start exporting at " .  date('l jS \of F Y h:i:s A') . "\n";
set_time_limit(3000);
$result_html = $interface->exportProducts();
//parse $result_html to only retain the csv format
preg_match('/<pre>(.*)<\/pre>/s',$result_html[0],$output);
if(strlen($output[1])<10) {   //debugging for now
echo "Export did not happen correctly. Quit\n";
    die('Export unsuccessful');
}
file_put_contents($output_path,$output[1]);
echo "Script completed. Thank you! \n";
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T21:48:50+00:00Added an answer on May 14, 2026 at 9:48 pm

    You can use the following curl options to log all the curl transfer details to a log file and check for any issues.

    $fp = fopen('./debug/transfer.log');
    curl_setopt($curl, CURLOPT_VERBOSE, TRUE);
    curl_setopt($curl, CURLOPT_STDERR, $fp);
    

    Also I believe that the CURLOPT_TIMEOUT option doesn’t support specifying a “0” value for an indefinite timeout. You need to specify the maximum timeout value here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 406k
  • Answers 406k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer could Silverlight be a true replacement for a true http… May 15, 2026 at 6:01 am
  • Editorial Team
    Editorial Team added an answer The problem is the __except clause needs to have an… May 15, 2026 at 6:01 am
  • Editorial Team
    Editorial Team added an answer You have to check out a file before you can… May 15, 2026 at 6:01 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.