1

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/>";
    }
}
Kurt McKee
  • 1,410
  • 13
  • 17

1 Answers1

0

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);
?>
Mathias Bynens
  • 144,855
  • 52
  • 216
  • 248