Zend - The PHP Company




XML

Add Code


fetching rss,xml archives  

Type: code fragment
Added by: goliche
Entered: 10/08/2001
Last modified: 09/12/2001
Rating: **** (4 votes)
Views: 10508
Using these coding lines xml can gather the existent information in any feed file. Only it is necessary to change her URL of the file to syndicate


<?php
$xmlfile 
fopen("www.minid.net/index.xml""r");
if(!
$xmlfile)die("no se puede abrir el archivo xml");
$readfile fread($xmlfile ,40000);
$searchfile eregi("<item>(.*)</item>"$readfile ,$arrayreg);
$filechunks explode("<item>"$arrayreg[0]);
$count count($filechunks);
for(
$i=$i<=$count-;$i++)
{
ereg("<title>(.*)</title>",$filechunks[$i], $title);
ereg("<link>(.*)</link>",$filechunks[$i], $links);
echo 
"<li>";
echo 
"<a href ='$links[1]'>$title[1]</a>";
echo 
"</li>";
}
?>


Usage Example


See the example


Rate This Script





Search



This Category All Categories