Giter VIP home page Giter VIP logo

opml-parser's Introduction

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](http://packagist.org/packages/imelgrat/opml-parser) can
be found over at [Packagist](http://packagist.org).

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

opml-parser's People

Contributors

imelgrat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

opml-parser's Issues

Read LOCAL OPML files

I'm trying to read a OPML file (sources.opml) stored in same path that opml-parser.php in server, but it doesn't work, even preceding with "DIR" the path.

$O_Contenido->ParseLocation('sources.opml', null);    // doesn't work
$O_Contenido->ParseLocation('./sources.opml', null);    // doesn't work
$O_Contenido->ParseLocation(__DIR__.'/sources.opml', null);    // doesn't work
$O_Contenido->ParseLocation('https:/mysite/sources.opml', null); // works

Am I doing something wrong? I noticed that you use "curl" to retrieve file, but not sure if that's the issue.

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.