Simple RSS Reader
function getrssdata($rssx,$item_strip)
{
$rsslength = strlen ($rssx);
$title_start=strpos($item_strip,”<”.$rssx.”>”);
$title_end=strpos($item_strip,”</”.$rssx.”>”);
$title_length=$title_end+$rsslength+3-$title_start;
$title=substr($item_strip, $title_start+$rsslength+2, $title_length-(($rsslength*2)+5));
return trim($title);
}
function readrss($rssfile)
{
global $fldID, $fldCountry, $fldCountryIndex;
$array=file_get_contents($rssfile);
$i=0; $counti=0;
while ($i!=1) {
$item_start=strpos($array,”<rec>”);
if ($item_start===false) {
$i=1;
}
else
{
$item_end=strpos($array,”</rec>”);
$item_length=$item_end+6-$item_start;
$item_strip=substr($array,$item_start,$item_length);
$fldID[$counti] = getrssdata(“fldID”,$item_strip);
$fldCountry[$counti] = getrssdata(“fldCountry”,$item_strip);
$fldCountryIndex[$counti] = getrssdata(“fldCountryIndex”,$item_strip);
$array=substr($array,$item_end+6); $counti++;
}
}
}
//———————————————————————————
readrss (“http://xxx.xx/myxml.xml”);
$arr_size = count ($fldID);
echo “Centers found: “.$arr_size.”<br><br>”;
function getrssdata($rssx,$item_strip)
{
$rsslength = strlen ($rssx);
$title_start=strpos($item_strip,”<”.$rssx.”>”);
$title_end=strpos($item_strip,”</”.$rssx.”>”);
$title_length=$title_end+$rsslength+3-$title_start;
$title=substr($item_strip, $title_start+$rsslength+2, $title_length-(($rsslength*2)+5));
return trim($title);
}
function readrss($rssfile)
{
global $fldID, $fldCountry, $fldCountryIndex, $fldCity, $fldCityAlias, $fldHost, $fldStreet, $fldcode,
$fldCityLocation, $fldTelefon, $fldTelefon2, $fldTelefon3, $fldFax, $fldHandy, $fldHandy2,
$fldDWBEmail, $fldForwardEmail, $fldURL, $fldFounded, $fldLongitude, $fldLatitude, $fldTyp;
$array=file_get_contents($rssfile);
$i=0; $counti=0;
while ($i!=1) {
$item_start=strpos($array,”<rec>”);
if ($item_start===false) {
$i=1;
}
else
{
$item_end=strpos($array,”</rec>”);
$item_length=$item_end+6-$item_start;
$item_strip=substr($array,$item_start,$item_length);
$fldID[$counti] = getrssdata(“fldID”,$item_strip);
$fldCountry[$counti] = getrssdata(“fldCountry”,$item_strip);
$fldCountryIndex[$counti] = getrssdata(“fldCountryIndex”,$item_strip);
$fldCity[$counti] = getrssdata(“fldCity”,$item_strip);
$fldCityAlias[$counti] = getrssdata(“fldCityAlias”,$item_strip);
$fldHost[$counti] = getrssdata(“fldHost”,$item_strip);
$fldStreet[$counti] = getrssdata(“fldStreet”,$item_strip);
$fldcode[$counti] = getrssdata(“fldcode”,$item_strip);
$fldCityLocation[$counti] = getrssdata(“fldCityLocation”,$item_strip);
$fldTelefon[$counti] = getrssdata(“fldTelefon”,$item_strip);
$fldTelefon2[$counti] = getrssdata(“fldTelefon2″,$item_strip);
$fldTelefon3[$counti] = getrssdata(“fldTelefon3″,$item_strip);
$fldFax[$counti] = getrssdata(“fldFax”,$item_strip);
$fldHandy[$counti] = getrssdata(“fldHandy”,$item_strip);
$fldHandy2[$counti] = getrssdata(“fldHandy2″,$item_strip);
$fldDWBEmail[$counti] = getrssdata(“fldDWBEmail”,$item_strip);
$fldForwardEmail[$counti] = getrssdata(“fldForwardEmail”,$item_strip);
$fldURL[$counti] = getrssdata(“fldURL”,$item_strip);
$fldFounded[$counti] = getrssdata(“fldFounded”,$item_strip);
$fldLongitude[$counti] = getrssdata(“fldLongitude”,$item_strip);
$fldLatitude[$counti] = getrssdata(“fldLatitude”,$item_strip);
$fldTyp[$counti] = getrssdata(“fldTyp”,$item_strip);
$array=substr($array,$item_end+6); $counti++;
}
}
}
//———————————————————————————
//readrss (“http://www.kagyu.net/xml2.asp”);
//$arr_size = count ($fldID);
//echo “Worldwide Centers found: “.$arr_size.”<br><br>”;