Location: PHPKode > projects > Laikwan WMC > wmc_20070325/magpie/index.php
<?php

define('MAGPIE_DIR', './');
require_once(MAGPIE_DIR.'rss_fetch.inc');


function cleanData($contents){	  
	//$contents = strip_tags($contents);
	$contents = ereg_replace("]]>", "]]&gt;", $contents);	 
	return "<![CDATA[" . $contents . "]]>";
}



$nameonly = $_GET['nameonly'];
$url = $_GET['url'];

header("Content-type: text/xml; charset=utf-8");  // must use text/xml for ajax/xmlhttp to work :(
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache");

echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n";
echo "<root>\n";

if ( $url ) {
	$rss = fetch_rss( $url );
	if($nameonly){
		echo "<name>" . $rss->channel['title'] . "</name>";
		echo "<count>" . count($rss->items) . "</count>";
	}else{
		echo "<msgType>emails</msgType>\n";
		foreach ($rss->items as $item) {
			echo "<email>";
			echo "<url>" . cleanData( $item['link'] ) . "</url>";
			echo "<title>" . cleanData( $item['title'] ) . "</title>";
			echo "<desc>" . cleanData( $item['description'] ) . "</desc>";
			echo "</email>\n";
		}
	}
}else{
	echo "<status>Url missing</status>\n";
}
echo "</root>\n";

?>

Return current item: Laikwan WMC