<?php
/*
* targetfrm.php Sample destination form
* Author: Manel Zaera (hide@address.com)
* Description: Singleton class to find syndication feeds in
* a website.
* Creation date: 2007-11-06
*
* This work is published under the GPL license (http://www.gnu.org/copyleft/gpl.html)
*
*/
require_once('FeedFinder.php');
$aFeedFinder = FeedFinder::getInstance();
header("Content-Type: text/xml");
header("Cache-Control: no-cache, must-revalidate");
$aFeeds = $aFeedFinder->getFeeds($_POST['url']);
$ajaxres='<?xml version="1.0" encoding="ISO-8859-1"?>';
$ajaxres.='<ajax-response>';
$feeddata = '<![CDATA[';
$feeddata .= '<br/><b>Found feeds </b>:<br/>';
foreach ($aFeeds as $aFeed) {
$aType = $aFeed['type'];
$aTypeName = ($aType==FeedFinder::FEED_TYPE_RSS1)?'RSS1':(($aType==FeedFinder::FEED_TYPE_RSS2)?'RSS2':(($aType==FeedFinder::FEED_TYPE_ATOM)?'Atom':'?'));
$feeddata .= '<a href="'.$aFeed['url'].'">'.$aFeed['title'].' ('.$aTypeName.') </a><br/>';
}
if (count($aFeeds) == 0) {
$feeddata .= 'No feeds';
}
$feeddata .= ']]>';
$ajaxres.='<response type="element" id="rescerca">'.$feeddata.'</response>';
$ajaxres.='</ajax-response>';
echo $ajaxres;
?>