开发者

PHP OPML Parser

开发者 https://www.devze.com 2022-12-23 17:43 出处:网络
Kindly tell me how to make an OPML parser. I have the code but it is not working for all generic OPML files:

Kindly tell me how to make an OPML parser. I have the code but it is not working for all generic OPML files:

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/&g开发者_高级运维t;";
    }
}


You could use a PHP OPML parser class, like this one: http://www.mt-soft.com.ar/2007/12/21/opml-parser-php-class/

Sample usage:

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

精彩评论

暂无评论...
验证码 换一张
取 消