PHP Classes

File: examples/index.php

Recommend this page to a friend!
  Classes of Ivan Melgrati   OPML Parser Class   examples/index.php   Download  
File: examples/index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: OPML Parser Class
Extract the properties of content from OPML files
Author: By
Last change: Update of examples/index.php
Date: 1 year ago
Size: 956 bytes
 

Contents

Class file image Download
<?php

   
use imelgrat\OPML_Parser\OPML_Parser;
    require_once (
'../src/opml-parser.php');
?>
<html>
<head>
<title>OPML Parser Example</title>
</head>
<body>
<form action="index.php" method="post" name="form1" target="_self" id="form1">
  <label>URL of OPML file
  <input name="url" type="text" id="url" value="<?php
   
echo ($_POST['url'] != '' ? $_POST['url'] : 'http://www.bbc.co.uk/podcasts.opml');
?>" size="60" maxlength="255"/>
  </label>
  <p>
    <label>
    <input type="submit" name="Submit" value="Submit" />
    </label>
  </p>
</form>
<p>&nbsp;</p>
<?php
   
   
if ($_POST['url'] != '')
    {
       
$parser = new OPML_Parser();

       
$parser->ParseLocation($_POST['url'], null);

        foreach (
$parser as $key => $item)
        {
            echo
"<p> Item: " . $key . '</p><ul>';
            foreach (
$item as $attribute => $value)
            {
                echo
'<li>' . '<strong>' . $attribute . '</strong>:' . $value . '</li>';
            }
            echo
'</ul>';
            echo
'<p>&nbsp;</p>';

        }
    }
?>
</body>
</html>