Ben iki yöntemle göstereyim,
en kolay yolu 1. yol
<?php
$xml = simplexml_load_file("http://www.takasel.com/sitemap.xml");
$value = array();
foreach ($xml->url as $value){
echo $value->loc. "<br>";
}
?>2. yol ise preg_match
<?php
function baglan($site){
$ch=curl_init("$site");
curl_setopt($ch,CURLOPT_URL,$site);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch,CURLOPT_REFERER,$site);
$al=curl_exec($ch);
curl_close($ch);
return $al;
}
$site = "http://www.takasel.com/sitemap.xml";
$giris = baglan($site);
preg_match_all('#<url>(.*?)</url>#si',$giris,$ben);
for($a=0; $a<5; $a++){
@$link = explode('<loc>', $ben[0][$a]);
@$link2= explode('</loc>', $link[1]);
@$linkler=$link2[0];
echo '<li><a href="'.$linkler.'">'.$linkler.'</a></li><br />';
}
?>