S.A merhaba arkadaşlar aşağıdaki php kodlarla haber sitelerinin rsslerinden haber başlıklarını çekiyorum. fakat hazırlamış olduğum sayfada birden fazla siteden aynı kodları kullanarak haber başlıklarını çekmek istiyorum. her ne yaptıysam yapamadım yardım edebilirmisiniz...




<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />
<META http-equiv="content-type" content="text/html; charset=windows-1254"/>
<style type="text/css">
<!--
.li {color: #cc0000}
.title {
font-size:10px;
color:#000000;
font-family:Verdana;
font-weight: bold;
}
-->
</style>

<?php 

$file = "http://rss.internethaber.com/last_min.xml"; 

$rss_channel = array(); 
$currently_writing = ""; 

$main = ""; 

$item_counter = 1; 

function startElement($parser, $name, $attrs) { 

global $rss_channel, $currently_writing, $main; 

switch($name) { 

case "RSS": 

case "RDF:RDF": 

case "ITEMS": 

$currently_writing = ""; 

break; 

case "CHANNEL": 

$main = "CHANNEL"; 

break; 

case "ITEM": 

$main = "ITEMS"; 

break; 

default: 

$currently_writing = $name; 

break; 

} 

} 

function endElement($parser, $name) { 

global $rss_channel, $currently_writing, $item_counter; 

$currently_writing = ""; 

if ($name == "ITEM") { 

$item_counter++; 

} 

} 

function characterData($parser, $data) { 

global $rss_channel, $currently_writing, $main, $item_counter; 

if ($currently_writing != "") { 

switch($main) { 

case "CHANNEL": 

if (isset($rss_channel[$currently_writing])) { 

$rss_channel[$currently_writing] .= $data; 

} else { 

$rss_channel[$currently_writing] = $data; 

} 

break; 

case "ITEMS": 

if (isset($rss_channel[$main][$item_counter][$currently_writing])) { 

$rss_channel[$main][$item_counter][$currently_writing] .= $data; 

} else { 

//print ("rss_channel[$main][$item_counter][$currently_writing] = $data<br>"); 

$rss_channel[$main][$item_counter][$currently_writing] = $data; 

} 

break; 

} 

} 

} 

$xml_parser = xml_parser_create(); 

xml_set_element_handler($xml_parser, "startElement", "endElement"); 

xml_set_character_data_handler($xml_parser, "characterData"); 

if (!($fp = fopen($file, "r"))) { 

die("could not open XML input"); 

} 

while ($data = fread($fp, 4096)) { 

if (!xml_parse($xml_parser, $data, feof($fp))) { 

die(sprintf("XML error: %s at line %d", 

xml_error_string(xml_get_error_code($xml_parser)), 

xml_get_current_line_number($xml_parser))); 

} 

} 

xml_parser_free($xml_parser); 

// output as HTML 

print ("<title>PHP RSS Reader</title><span class='li'><body>"); 

if (isset($rss_channel["ITEMS"])) { 

if (count($rss_channel["ITEMS"]) > 1) { 

for($i = 1;$i < count($rss_channel["ITEMS"]);$i++) { 

print ("\n<li><a href=\"" . $rss_channel["ITEMS"][$i]["LINK"] . "\" target=\"_blank\" style=\"text-decoration: none\"><span class='title'>" . $rss_channel["ITEMS"][$i]["TITLE"] . "</span></br></a></li></b>"); 

} 

} else { 

print ("<b>There are no articles in this feed.</b>"); 

} 

} 

print ("</span></body></html>"); 

?>