I've got a old blog on blogger that consists of 1000's of images and posts, i've already imported the posts from blogger to wordpress utilizing their import service (which doesn't import images) now i wish to write a php cURL script which will download all of the images off my old blogger blog to wordpress.


I've already written a script that experiences all of the posts and discover the look links of blogger and download the hyperlinks recursively and store them close to wordpress installation but however , the script stops if it is taking more than max_execution_time that is generally set to 30 secs. Now i shouldn't change establishing php.ini file. Can there be a way will be able to keep my script performing for your lengthy as well as other alternative.... like performing in batch or something like that else...

Reason behind not altering php.ini configurations is the fact that i wish to release this script as opensource wordpress plugin for wordpress, and never many get access to their php.ini file around the server and and several can't stand altering configurations for starters script that may run only once.

Appreciate helping....

You are able to modify some ini configurations at run time, so that they only modify the current version from the script. Within this situation, there is a special function, set_time_limit():


This can effectively take away the time period limit in your script execution. Other scripts is going to be untouched.

If you are in a position to call set_time_limit for many other, non-zero time, you are able to totally reset time limit every time you iterate, because the timer is totally reset every time it's set.

Or, better stated through the paperwork :

When known as, set_time_limit() restarts the timeout counter from zero. In short, when the timeout may be the default thirty seconds, and 25 seconds into script execution a phone call for example set_time_limit(20) is created, the script will run for a maximum of 45 seconds before timing out.

Just make certain you choose a sufficiently very long time for every iteration to accomplish