Search code examples
phpweb-scrapingweb-crawlersimple-html-dommax-execution-timeout

time exceed in PHP ? Want to increase time?


I am trying to parsing HTML data from HTML file. I have a file which contains many links . I get those links and load them in file_get_contents($link) (I use simple_html_dom for all This stuff ) and want to find specific text in those link . It works great for three or five links after than I got fatal error: time exceeded 30 seconds in simple HTML Dom line 82 .

What are the problem I guessed ? Slow internet speed (that I can not increase) . PHP.INI file configuration Simplehtmldom configuration

What I tried but failed ?

I have edited max_execution_time to 0 and 300 but not worked after restart server (using local XAMPP server )

I also tried to edit simple_HTML_Dom.PHP but did not worked .

I do not know whether my server setting safe mode is on or not

Thank you , Actually we are group of college student trying to make a project.


Solution

  • I know you tried setting max_execution_time, but you can try setting it using ini_set directly in your PHP script:

    ini_set('max_execution_time', 300);
    

    Also try default_socket_timeout, this will change the default timeout of the file_get_contents function:

    ini_set('default_socket_timeout', 300);