title: Set time out on simplexml_load_file
body: <p>I have this script which outputs an rss feed. Want I want to do is have it attempt to reach the rss url for something like 5 sec tops, and if it cannot then I want it to load a backup xml doc that is on the server. This is what I have and it is not working:</p>
  
  <pre><code> &lt;?php
  
   include '../php/connect.php';
   $metaData = mysql_query("SELECT * FROM `siteinfo`") or die("couln't find table :(");
   $displayData = mysql_fetch_assoc($metaData);
   $url = $displayData['status'];
   $xml = file_get_contents($url);
  
   stream_set_timeout($xml, 5);
  
  if ($xml == FALSE) {
  
     $xml = simplexml_load_file('backUpXml.xml');
  
     foreach ($xml-&gt;channel-&gt;item as $item) {
        echo '&lt;a href="'.$item-&gt;guid.'" alt="'.$item-&gt;title.'" target="_blank"&gt;',   substr($item-&gt;title, 0, 62), '...&lt;/a&gt;&lt;br /&gt;&lt;span&gt;', substr($item-&gt;pubDate, 4, 18),'&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;';
     }
  }  else {
  
     $xml = simplexml_load_file($url);
  
     foreach ($xml-&gt;channel-&gt;item as $item) {
          echo '&lt;a href="'.$item-&gt;guid.'" alt="'.$item-&gt;title.'" target="_blank"&gt;', substr($item-&gt;title, 0, 62), '...&lt;/a&gt;&lt;br /&gt;&lt;span&gt;', substr($item-&gt;pubDate, 4, 18),'&lt;/span&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;';
     }
  }
  
   ?&gt;
  </code></pre>
  
  <p>I am getting a time out error and that is all. Any insight would be great!</p>