Set time out on simplexml_load_file

后端 未结 3 608
忘了有多久
忘了有多久 2020-12-20 21:51

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 loa

3条回答
  •  猫巷女王i
    2020-12-20 22:01

    This is what I got working:

        channel->item as $item) {
              echo '',   substr($item->title, 0, 62), '...
    ', substr($item->pubDate, 4, 18),'


    '; } } else { $myFile = "content/backUpXml.xml"; $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = $xml; fwrite($fh, $stringData); fclose($fh); $xml = simplexml_load_file($url); foreach ($xml->channel->item as $item) { echo '', substr($item->title, 0, 62), '...
    ', substr($item->pubDate, 4, 18),'


    '; } } ?>

提交回复
热议问题