PHP Classes

OPML Parser Class: Extract the properties of content from OPML files

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 787 All time: 4,330 This week: 673Up
Version License PHP version Categories
iam-opml-parser 2.9Custom (specified...5.3XML, Content management
Description 

Author

The class can retrieve local or remote OPML file and parses it to extract its content using an iterator.

Each of the iterated elements contain the URLs of the listed content as well all other the properties of each content entry such as: name, link target, description, RSS feed, creation date and content type (RSS, HTML, song, booklist, etc..).

Innovation Award
PHP Programming Innovation award nominee
July 2007
Number 13
OPML is an XML format often used to aggregate URLs of multiple RSS feeds.

This package can be used parse and extract information about the URLs listed in OPML files. It can help importing the URLs of multiple RSS feeds into other applications.

Manuel Lemos
Picture of Ivan Melgrati
  Performance   Level  
Name: Ivan Melgrati is available for providing paid consulting. Contact Ivan Melgrati .
Classes: 11 packages by
Country: Argentina Argentina
Age: 49
All time rank: 1973 in Argentina Argentina
Week rank: 240 Down3 in Argentina Argentina Equal
Innovation award
Innovation award
Nominee: 3x

Example

<?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>


Details

OPML Parser

GitHub license GitHub release Total Downloads GitHub issues GitHub stars

OPML Parser Class: Extract the properties of content from OPML files.

A file with the OPML file extension is an Outline Processor Markup Language file. It's saved using the XML format, and is used to exchange information between applications regardless of the operating system.

The OPML file format is often seen used as the import/export format for RSS feed reader programs. Since a file of this format can hold a collection of RSS subscription information, it's the ideal format for backing up or sharing RSS feeds. The class retrieves local or remote OPML file and parses it to extract its content into a PHP iterator. Each of the iterator elements contains the URLs of the listed content as well all other the properties of each content entry such as: name, link target, description, RSS feed, creation date and content type (RSS, HTML, song, booklist, etc..).

Developed by Ivan Melgrati

Requirements

  • PHP >= 5.3.0

Installation

Composer

The recommended installation method is through Composer, a dependency manager for PHP. Just add imelgrat/opml-parser to your project's composer.json file:

{
    "require": {
        "imelgrat/opml-parser": "*"
    }
}

More details can
be found over at Packagist.

### Manually

1.  Copy `src/opml-parser.php` to your codebase, perhaps to the `vendor`
    directory.
2.  Add the `OPML_Parser` class to your autoloader or `require` the file
    directly.

Then, in order to use the OPML class, you need to invoke the "use" operator to bring the class into skope.

<?php use imelgrat\OPML_Parser\OPML_Parser;

$parser = new OPML_Parser();

// Get OPML from URL $parser->ParseLocation('http://www.bbc.co.uk/podcasts.opml', null);

// Walk through each item in the same way as we would if $parser were a string (thanks to the Iterator interface) 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>';

} ?>


Feedback
--------

Please open an issue to request a feature or submit a bug report. Or even if
you just want to provide some feedback, I'd love to hear. I'm also available on
Twitter as @imelgrat.

Contributing
------------

1.  Fork it.
2.  Create your feature branch (`git checkout -b my-new-feature`).
3.  Commit your changes (`git commit -am 'Added some feature'`).
4.  Push to the branch (`git push origin my-new-feature`).
5.  Create a new Pull Request.

  Files folder image Files (68)  
File Role Description
Files folder imagedocs (2 files, 9 directories)
Files folder imageexamples (1 file)
Files folder imagesrc (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file phpdoc.dist.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file VERSION Data Auxiliary data

  Files folder image Files (68)  /  docs  
File Role Description
Files folder imageclasses (2 files)
Files folder imagecss (5 files, 1 directory)
Files folder imagefiles (2 files)
Files folder imagefont (1 file)
Files folder imagegraphs (2 files)
Files folder imageimages (18 files, 1 directory)
Files folder imagejs (10 files, 1 directory)
Files folder imagenamespaces (3 files)
Files folder imagereports (3 files)
  Accessible without login Plain text file .htaccess Data Auxiliary data
  Accessible without login HTML file index.html Doc. Documentation

  Files folder image Files (68)  /  docs  /  classes  
File Role Description
  Accessible without login HTML file imelgrat.OPML_Parser.OPML_Parser.html Doc. Documentation
  Accessible without login HTML file OPML_Parser.html Doc. Documentation

  Files folder image Files (68)  /  docs  /  css  
File Role Description
Files folder imagephpdocumentor-clean-icons (2 files, 1 directory)
  Accessible without login Plain text file bootstrap-combined.no-icons.min.css Data Auxiliary data
  Accessible without login Plain text file font-awesome.min.css Data Auxiliary data
  Accessible without login Plain text file jquery.iviewer.css Data Auxiliary data
  Accessible without login Plain text file prism.css Data Auxiliary data
  Accessible without login Plain text file template.css Data Auxiliary data

  Files folder image Files (68)  /  docs  /  css  /  phpdocumentor-clean-icons  
File Role Description
Files folder imagefonts (2 files)
  Accessible without login Plain text file lte-ie7.js Data Auxiliary data
  Accessible without login Plain text file style.css Data Auxiliary data

  Files folder image Files (68)  /  docs  /  css  /  phpdocumentor-clean-icons  /  fonts  
File Role Description
  Accessible without login Plain text file phpdocumentor-clean-icons.dev.svg Data Auxiliary data
  Accessible without login Plain text file phpdocumentor-clean-icons.svg Data Auxiliary data

  Files folder image Files (68)  /  docs  /  files  
File Role Description
  Accessible without login HTML file opml-parser.html Doc. Documentation
  Accessible without login Plain text file opml-parser.php.txt Doc. Documentation

  Files folder image Files (68)  /  docs  /  font  
File Role Description
  Accessible without login Plain text file fontawesome-webfont.svg Data Auxiliary data

  Files folder image Files (68)  /  docs  /  graphs  
File Role Description
  Accessible without login HTML file class.html Doc. Documentation
  Accessible without login Plain text file classes.svg Data Auxiliary data

  Files folder image Files (68)  /  docs  /  images  
File Role Description
Files folder imageiviewer (8 files)
  Accessible without login Image file android-chrome-192x192.png Icon Icon image
  Accessible without login Image file android-chrome-512x512.png Data Auxiliary data
  Accessible without login Image file apple-touch-icon-114x114.png Icon Icon image
  Accessible without login Image file apple-touch-icon-72x72.png Icon Icon image
  Accessible without login Image file apple-touch-icon.png Icon Icon image
  Accessible without login Plain text file custom-icons.svg Data Auxiliary data
  Accessible without login Image file favicon-16x16.png Icon Icon image
  Accessible without login Image file favicon-32x32.png Icon Icon image
  Accessible without login Image file favicon.ico Data Auxiliary data
  Accessible without login Image file hierarchy-item.png Icon Icon image
  Accessible without login Image file icon-class-13x13.png Icon Icon image
  Accessible without login Plain text file icon-class.svg Data Auxiliary data
  Accessible without login Image file icon-interface-13x13.png Icon Icon image
  Accessible without login Plain text file icon-interface.svg Data Auxiliary data
  Accessible without login Image file icon-trait-13x13.png Icon Icon image
  Accessible without login Plain text file icon-trait.svg Data Auxiliary data
  Accessible without login Image file mstile-150x150.png Icon Icon image
  Accessible without login Plain text file safari-pinned-tab.svg Data Auxiliary data

  Files folder image Files (68)  /  docs  /  images  /  iviewer  
File Role Description
  Accessible without login Image file grab.cur Data Auxiliary data
  Accessible without login Image file hand.cur Data Auxiliary data
  Accessible without login Image file iviewer.rotate_left.png Icon Icon image
  Accessible without login Image file iviewer.rotate_right.png Icon Icon image
  Accessible without login Image file iviewer.zoom_fit.png Icon Icon image
  Accessible without login Image file iviewer.zoom_in.png Icon Icon image
  Accessible without login Image file iviewer.zoom_out.png Icon Icon image
  Accessible without login Image file iviewer.zoom_zero.png Icon Icon image

  Files folder image Files (68)  /  docs  /  js  
File Role Description
Files folder imageui (1 directory)
  Accessible without login Plain text file bootstrap.min.js Data Auxiliary data
  Accessible without login Plain text file html5.js Data Auxiliary data
  Accessible without login Plain text file jquery-1.11.0.min.js Data Auxiliary data
  Accessible without login Plain text file jquery.dotdotdot-1.5.9.js Data Auxiliary data
  Accessible without login Plain text file jquery.dotdotdot-1.5.9.min.js Data Auxiliary data
  Accessible without login Plain text file jquery.iviewer.js Data Auxiliary data
  Accessible without login Plain text file jquery.iviewer.min.js Data Auxiliary data
  Accessible without login Plain text file jquery.mousewheel.js Data Auxiliary data
  Accessible without login Plain text file jquery.smooth-scroll.js Data Auxiliary data
  Accessible without login Plain text file prism.min.js Data Auxiliary data

  Files folder image Files (68)  /  docs  /  js  /  ui  
File Role Description
Files folder image1.10.4 (1 file)

  Files folder image Files (68)  /  docs  /  js  /  ui  /  1.10.4  
File Role Description
  Accessible without login Plain text file jquery-ui.min.js Data Auxiliary data

  Files folder image Files (68)  /  docs  /  namespaces  
File Role Description
  Accessible without login HTML file default.html Doc. Documentation
  Accessible without login HTML file imelgrat.html Doc. Documentation
  Accessible without login HTML file imelgrat.OPML_Parser.html Doc. Documentation

  Files folder image Files (68)  /  docs  /  reports  
File Role Description
  Accessible without login HTML file deprecated.html Doc. Documentation
  Accessible without login HTML file errors.html Doc. Documentation
  Accessible without login HTML file markers.html Doc. Documentation

  Files folder image Files (68)  /  examples  
File Role Description
  Accessible without login Plain text file index.php Example Example script

  Files folder image Files (68)  /  src  
File Role Description
  Plain text file opml-parser.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:787
This week:0
All time:4,330
This week:673Up