tarlejh Posted March 30, 2009 Share Posted March 30, 2009 So I'm using file_get_contents to retrieve an XML file over HTTP. I'm using ini_set() to time out the default socket at 5 seconds. In my code, I am parsing the XML into an simple 2D array which I iterate through after checking that it is not empty: if ( !empty($myarray) ) { //break; } else { //assign hardcoded data to $myarray } //iterate through $myarray or something to that effect. A problem arises that sometimes the array is empty, maybe one out of every 50 page loads or so. Can't seem to determine why this could be, except that file_get_contents() is taking longer than 5 seconds. Yet I've timed that particular call (in a dev environment) and cannot get it to take longer than 3/100 of a second. Any help from the community with this vexing issue is much appreciated. Quote Link to comment Share on other sites More sharing options...
Brian W Posted March 30, 2009 Share Posted March 30, 2009 it could be a hiccup in the server... don't know the cause, but it happens every once in a while even on the sturdiest server. I've had it happen on both IIS 5-7 and different releases of Apache. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.