Ratings | | Unique User Downloads | | Download Rankings |
Not yet rated by the users | | Total: 66 | | All time: 10,366 This week: 673 |
|
Description | | Author |
This package can retrieve RSS feed and extract URLs they contain.
It can send a request to a HTTP server to retrieve the feed of a given URL. The HTTP user agent name is a configurable option.
The class also retrieves the robots.txt file of the site to determine if the requested feed is allowed to be retrieved.
The class can parse feed XML data to extract the URLs they contain.
The package supports feeds in the formats of RSS (1.0 and 2.0), ATOM and OPML. | |
|
|
Innovation award
Nominee: 3x |
|
Example
<?php
require_once ('../src/feed-finder.php');
$url = 'https://imelgrat.me';
$useragent = 'GoogleBot';
$obey = false;
if($_POST['submit'] != '')
{
if($_POST['url'] != '')
{
$url = trim($_POST['url']) ;
}
if($_POST['useragent'] != '')
{
$useragent = trim($_POST['useragent']) ;
}
$obey = $_POST['obey']?true:false;
$find_links = new FeedFinder();
$links = $find_links->setURL($url)->setUserAgent($useragent)->setObeyRobots($obey)->getFeeds();
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>FeedFinder Example</title>
</head>
<body>
<h1>Feed Finder Tester</h1>
<form action="" method="post">
<div><label for="url"><strong>URL: </strong><input name="url" type="text" value="<?php echo $url;?>" size="100" ></label></div>
<div><label for="useragent"><strong>User Agent: </strong><input name="useragent" type="text" value="<?php echo $useragent;?>" size="100" ></label></div>
<div><label for="obey"><strong>Obey robots.txt? </strong><input name="obey" type="checkbox" value="1" <?php if($obey){echo 'checked="checked"';}?> ></label></div>
<div><input type="submit" name="submit" value="Find Feeds"></div>
</form>
<?php if($_POST['submit']!=''): ?>
<h2>Feeds found on URL:</h2>
<?php
foreach($links as $row)
{
echo "<p>{$row}</p>";
}
?>
<?php endif; ?>
</body>
</html>
|
Details
FeedFinder
A PHP class for extracting the URLs of RSS (1.0 and 2.0) and ATOM feeds associated to a page, as well as OPML outline documents.
Developed by Ivan Melgrati
Requirements
Installation
Composer
The recommended installation method is through
Composer, a dependency manager for PHP. Just add
imelgrat/feed-finder
to your project's composer.json
file:
{
"require": {
"imelgrat/feed-finder": "*"
}
}
More details can
be found over at Packagist.
Manually
-
Copy `src/feed-finder.php` to your codebase, perhaps to the `vendor`
directory.
-
Add the `FeedFinder` class to your autoloader or `require` the file directly.
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
-
Fork it.
-
Create your feature branch (`git checkout -b my-new-feature`).
-
Commit your changes (`git commit -am 'Added some feature'`).
-
Push to the branch (`git push origin my-new-feature`).
-
Create a new Pull Request.
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.