douzheren3349 2010-07-16 14:16
浏览 95
已采纳

如何创建php RSS模拟器?

So I have RSS feed of 10 000 records in file.xml (I collected them from 10 feeds in 1 hour time so there timestamps will not help, btw I used yahoo pipes). I need some class to simulate that records appearing 24 per a day with 1 per hour.

How I see it:

  1. turn file.xml into sql table (if you know a class for this please help)

  2. create timestamps (can any one give a good way for generating timestamps for 10 000 records?)

  3. create class for returning rss (looking at computer clock and returning records from first to now) (could you please provide a way for generating valid RSS from DB?)

So please provide any help if you can.

I use xampp as php apache mysql server holder.

I am going to use it localy in my dev machin (both sides - server and client)

  • 写回答

2条回答 默认 最新

  • drsvw88664 2010-07-20 21:32
    关注
    $doc = new DOMDocument();
    $doc->loadHTMLFile($file);
    
    $xpath = new DOMXpath($doc);
    $elements = $xpath->query("//fileroot/nodes");
    if (!is_null($elements)) {
      $dateinterval = [0 hours];
    
      foreach ($elements as $element) {
         // read each node and then store it...
         $storycontents = $element->nodeValue;
         $storytimestamp = date() - $dateinterval;
         $dateinterval = $dateinterval - [1 hour];
    
         [add story to rss feed]
      }
    }
    
    [render all of the collected rss feed stories]
    

    Some of it is pseudocode where you can fill it out. But something along these lines basically.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥23 (标签-bug|关键词-密码错误加密)
  • ¥66 比特币地址如何生成taproot地址
  • ¥20 数学建模数学建模需要
  • ¥15 关于#lua#的问题,请各位专家解答!
  • ¥15 什么设备可以研究OFDM的60GHz毫米波信道模型
  • ¥15 不知道是该怎么引用多个函数片段
  • ¥30 关于用python写支付宝扫码付异步通知收不到的问题
  • ¥15 隐藏系统界面pdf的打印、下载按钮
  • ¥15 基于pso参数优化的LightGBM分类模型
  • ¥15 安装Paddleocr时报错无法解决