/** * Load an xml file through HTTP * * @param string $xmlUrl String corresponding to the XML URL * @param array $feed Feed * @param array $items Items * @param boolean $force Force update * * @return array containing feed and items */ public function loadRss($xmlUrl, $feed = array(), $force = false) { $items = array(); $feed = $this->initFeedCache($feed, $force); if (!ini_get('safe_mode') && isset(MyTool::$opts['http']['timeout'])) { set_time_limit(MyTool::$opts['http']['timeout'] + 1); } $outputUrl = MyTool::loadUrl($xmlUrl); if (!empty($outputUrl['error'])) { $feed['error'] = $outputUrl['error']; } else { if (empty($outputUrl['data'])) { if ($outputUrl['code'] != 304) { // 304 Not modified $feed['error'] = Intl::msg('Empty output data'); } } else { $outputDom = Rss::loadDom($outputUrl['data']); if (!empty($outputDom['error'])) { $feed['error'] = $outputDom['error']; } else { unset($feed['error']); $feed = $this->updateFeedFromDom($feed, $outputDom['dom']); $feed = $this->updateFeedCache($feed, $outputUrl); $items = $this->updateItemsFromDom($outputDom['dom']); } } } $feed['lastUpdate'] = time(); return array('feed' => $feed, 'items' => $items); }