【问题标题】:PHP OPML ParserPHP OPML 解析器
【发布时间】:2010-03-23 17:39:07
【问题描述】:

请告诉我如何制作一个 OPML 解析器。我有代码,但它不适用于所有通用 OPML 文件:

if (file_exists('test.opml')) {
    $xml =simplexml_load_file('test.opml');
}

for($i=0;$i<=count($xml);$i++) {
    $array=array($xml->body->outline->outline[$i]);
    $key=(array_keys($array));
    foreach ($array as $key) {
        echo "<strong>".($key['xmlUrl'][0])."</strong><br/>";
    }
}

【问题讨论】:

    标签: php parsing opml


    【解决方案1】:

    您可以使用 PHP OPML 解析器类,例如:http://www.mt-soft.com.ar/2007/12/21/opml-parser-php-class/

    示例用法:

    <?php
    $url = 'http://example.com/foo.opml'; // URL of OPML file
    $parser = new IAM_OPML_Parser();
    echo $parser->displayOPMLContents($url);
    ?>
    

    【讨论】:

      猜你喜欢
      • 2023-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-02
      • 2011-11-17
      • 2012-02-12
      • 2014-09-17
      相关资源
      最近更新 更多