Jump to content

RSS 1.0 or RDF


rarebit

Recommended Posts

Hi, i've just been having a play with rss, version 2 slid into place but version 1 seems to have variations and the official php docs don't mention rdf, any clues please?

 

function xml_load($fn)
{
if (file_exists($fn))
{
	$xml = simplexml_load_file($fn);
	return $xml;
}
return -1;
}

function xml_print_e($e)
{
if( (isset($e->link)) && (isset($e->title)) )
{
	print '<a href="'.$e->link.'">'.$e->title.'</a><br>';
}
elseif( isset($e->title) )
{
	print $e->title.'<br>';
}

if(isset($e->description))
{
	print $e->description.'<br>';
}
print '<br><br>';
}

//$fn = "data/rss1.xml";
$fn = "data/rss2.xml";

$xml = xml_load($fn);

print $xml->attributes()->version;
print "<br><br>";
$x = $xml->channel;
xml_print_e($x);
foreach ($x->item as $e)
{
xml_print_e($e);
}

Link to comment
https://forums.phpfreaks.com/topic/122448-rss-10-or-rdf/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.