1

I have get weather from remote web using simplexml_load_file() function.

It's works fine in normal condition.But when Internet is not available then my script wait for long time for response.

I have execute php page from embedded board not from browser.

So I want to put time out for that.

Is it possible to put connection time out in simplexml_load_file() ?

If any other alternative then please tell me.

Hkachhia
  • 4,463
  • 6
  • 41
  • 76
  • possible duplicate of [how to increase the timeout in php?](http://stackoverflow.com/questions/3829403/how-to-increase-the-timeout-in-php) – Michael Berkowski Dec 29 '12 at 16:21
  • @MichaelBerkowski Not duplicate see my question again – Hkachhia Dec 31 '12 at 07:28
  • Duplicate of [Set time out on simplexml_load_file](http://stackoverflow.com/questions/12399610/set-time-out-on-simplexml-load-file/32586480) – jap1968 Sep 15 '15 at 12:48

1 Answers1

1

You are looking for the PHP function called set_time_limit(), which allows you to cap the execution time of a PHP script.

L0j1k
  • 12,255
  • 7
  • 53
  • 65
  • Hey is it work when I will execute php page from embedded board ? – Hkachhia Dec 31 '12 at 07:24
  • I don't know why it wouldn't. `set_time_limit()` is a native PHP function, so it should work regardless of the hardware you're running it on, unless you are running a special version of PHP. Even then, I doubt this function would be excluded from a special version because of the potential importance it could play in an embedded system. – L0j1k Dec 31 '12 at 07:55