<?php
$feed = 'http://www.computerworld.com/news/xml/0,5000,73,00.xml';
ini_set('allow_url_fopen', true);
$fp = fopen($feed, 'r');
$xml = '';
while (!feof($fp)) {
$xml .= fread($fp, 128);
}
fclose($fp);
function untag($string, $tag) {
$tmpval = array();
$preg = "|<$tag>(.*?)</$tag>|s";
preg_match_all($preg, $string, $tags);
foreach ($tags[1] as $tmpcont){
$tmpval[] = $tmpcont;
}
return $tmpval;
}
$items = untag($xml, 'item');
$html = '
';
foreach ($items as $item) {
$title = untag($item, 'title');
$link = untag($item, 'link');
$html .= '<a href="' . $link[0] . '">' . $title[0] . "</a>
\n";
}
$html .= '';
echo $html;
?>