is there a way to set a time out for f_g_c ?

given:


					// number of items
					$items = 5;
					$xml = "http://www.newcougar.org/forums/external.php?forumids=45&type=RSS2&lastpost=true";
					if(file_get_contents($xml) !=="")
					{	
						// Retrieve XML data
						$simple = simplexml_load_file($xml);

						for($i=0;$i<$items;$i+=1)
					   	{
					   	echo "<DIV CLASS=\"DIV18B\"><img src=\"images/icons/rss.png\" align=\"absmiddle\"/> <a href=\"{$simple->channel->item[$i]->link}\">{$simple->channel->item[$i]->title}</a></DIV>\n";
					  	}
					}
					else 
					{
						echo "<img src=\"images/icons/close.png\" align=\"top\"/> <b>Feed Unavailable</b>";
					}

right now that url is down b/c the site is getting moved... however it'll hang my page up till FGC figures out theres nothing there.... is there a way either time that out or keep it from hanging the page up...

someone said something about using OB...

please note that the php code above i embedded into HTML within a page

    One thing you might try is using [man]fsockopen/man to open a socket to the remote system and then send the HTTP headers manually. An example of this can be found in the PHP manual under example 1. Using this function allows you to utilize the "timeout" parameter of opening the remote socket.

      9 days later

      The only way is to set in php.ini the default_socket_timeout value. I try before to use resource context on PHP5 but it's imposible for this part of timeout.
      If you will try to use fsockopen() then you should pay attention how to split the body message from header (the \r\n\r\n doesn't work in all of cases).

        Write a Reply...