phpxmlurlretrieve

How to rerun a the script when an error occured?


I have written a script that search for values in xml file. This files I retrieve online via the following code

# Reads entire file into a string
    $result = file_get_contents($xml_link);
    # Returns the xml string into an object
    $xml = simplexml_load_string($result);

But the xml are somethimes are big with as consequence that I got the following error Fatal error: Maximum execution time of 30 seconds exceeded. I have adapted the ini.php files to max_exucution time set to a 360 seconds but I still got the same error.

I have two options in mind.


Solution

  • When I used these two lines in my script the problem was solved.

    ini_set('max_execution_time', 300);
    set_time_limit(0);