php - How to prevent an execution timeout error message to appear? -


i've got piece of php code retrieving last tweet :

$twitterrequest = 'http://api.twitter.com/1/statuses/user_timeline.json?user_id=' . $user_id . '&include_rts=true&count=' . $tweetstodisplay;  $twitterci = curl_init($twitterrequest);  curl_setopt($twitterci, curlopt_returntransfer, true);  $twitterinput = curl_exec($twitterci);  curl_close($twitterci);  return ($twitterinput);  

when internet connection busy ocasionally following message :

fatal error: maximum execution time of 30 seconds exceeded in d:...\www...\wp-content\themes...\home_tweet.php on line 26

how prevent that, displaying nothing rather ugly error message ?

it might more elegant limit time curl waits answer:

curl_setopt($twitterci, curlopt_timeout, 10); 

to give 10 seconds. way opportunity handle timeout condition in user-friendly way.

if that's not looking for, have @ how suppress specific error in php


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -