<?php
$con = file_get_contents('http://botd.wordpress.com/topsites-ta.xml/');/* Feed Url */
$title = getlinks("<title>", "</title>", $con); // gets Title and stored in array
$url = getlinks("<link>", "</link>", $con); // gets Url and stored in array
echo "<ul>";
for($i=0; $i < 6; $i++) {
echo '<li><a href="'.$url[$i].'" title="'.$title[$i].'" >'.urldecode($title[$i]).'</a></li>';
}
echo "</ul>";
function getlinks($s1,$s2,$s) {
$myarray=array();
$s1 = strtolower($s1);
$s2 = strtolower($s2);
$L1 = strlen($s1);
$L2 = strlen($s2);
$scheck=strtolower($s);
do {
$pos1 = strpos($scheck,$s1);
if($pos1!==false) {
$pos2 = strpos(substr($scheck,$pos1+$L1),$s2);
if($pos2!==false) {
$myarray[]=substr($s,$pos1+$L1,$pos2);
$s=substr($s,$pos1+$L1+$pos2+$L2);
$scheck=strtolower($s);
}
}
}
while (($pos1!==false)and($pos2!==false));
return $myarray;
}
?>
preferences:
34.28 ms | 402 KiB | 5 Q