PHP Classes

File: examples/example.php

Recommend this page to a friend!
  Classes of Ivan Melgrati   PHP Find RSS Feed URL   examples/example.php   Download  
File: examples/example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Find RSS Feed URL
Retrieve RSS feed and extract URLs they contain
Author: By
Last change:
Date: 4 years ago
Size: 1,358 bytes


Class file image Download

require_once ('../src/feed-finder.php');
$url = '';
$useragent = 'GoogleBot';
$obey = false;

$_POST['submit'] != '')
$_POST['url'] != '')
$url = trim($_POST['url']) ;
$_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>
<meta charset="utf-8">
<title>FeedFinder Example</title>
    <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>
    <?php if($_POST['submit']!=''): ?>
<h2>Feeds found on URL:</h2>
foreach($links as $row)
<?php endif; ?>