-1

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.

Community
  • 1
  • 1
kya hai
  • 23
  • 3

2 Answers2

0

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);
François Huppé
  • 2,006
  • 1
  • 6
  • 15
  • Thank you Fransico Huppe for helping us. We just want to ask that setting PHP.INI and ini_set different ? – kya hai Jul 06 '19 at 13:31
  • not really, ini_set is use when you want to change a config for a particular script only, but if you change it in PHP.INI and the server is properly restarted, it has the same effect – François Huppé Jul 06 '19 at 15:39
0

Making max_execution_time to 0 in PHP.ini is a bad idea this is because timeouts are essential for webserver. However, in order to facilitate long time consuming script, you may use ini_set('max_execution_time', 0) which temporarily sets the value for max_execution_time.

Having put the value in script, keeps the new value during the script's execution, and will be restored at the script's ending.

Sandhya Nair
  • 157
  • 2
  • 9