Example #1
0
 /**
  * 从RSS抓取数据
  * @author Mr.Cong <*****@*****.**>
  */
 public function getData($parameters)
 {
     $feed = FeedsFacade::make($this->base_uri);
     $data = array('title' => $feed->get_title(), 'permalink' => $feed->get_permalink(), 'items' => $feed->get_items());
     $log_name = 'chinagdg.lock';
     $lock_title = $data['items'][0]->get_title();
     if (checkLock($log_name, $lock_title)) {
         //开始读取数据保存进数据库
         $this->saveData($data);
     }
     print 0;
     exit;
 }
Example #2
0
 /**
  * 从RSS抓取数据
  * @author Mr.Cong <*****@*****.**>
  */
 public function getData($fids = array())
 {
     foreach ($fids as $key => $fid) {
         $this->fid = $fid;
         $this->build_query = sprintf('forum.php?mod=rss&fid=%s&auth=0', $fid);
         $feed = FeedsFacade::make($this->base_uri . $this->build_query);
         $data = array('title' => $feed->get_title(), 'permalink' => $feed->get_permalink(), 'items' => $feed->get_items());
         /*
          * 获取到最新的一条的标题
          */
         $log_name = $fid . '.lock';
         $lock_title = $data['items'][0]->get_title();
         if (checkLock($log_name, $lock_title)) {
             //开始读取数据保存进数据库
             $this->saveData($data);
         } else {
             break;
         }
         unset($feed);
         unset($data);
         unset($log_name);
         unset($lock_title);
     }
 }
 /**
  * @return \Illuminate\View\View
  */
 public function index()
 {
     $feed = Facades\FeedsFacade::make('http://feeds.feedburner.com/tvnet/all/top', false);
     $data = array('title' => $feed->get_title(), 'permalink' => $feed->get_permalink(), 'items' => $feed->get_items(0, 5));
     return view('feed.index', compact('data'));
 }
 public function index()
 {
     $feed = Feed::make("https://www.reddit.com/r/ffxiv/new/.rss");
     return view('layout.main', ['feed' => $feed]);
 }