require_once 'magpierss/rss_fetch.inc';
$url = array( 'http://weather.msn.com/RSS.aspx?wealocations=wc:UKXX0085&weadegreetype=C',
'http://weather.msn.com/RSS.aspx?wealocations=wc:USNY0996&weadegreetype=C',
'http://weather.msn.com/RSS.aspx?wealocations=wc:JAXX0085&weadegreetype=C',
'http://weather.msn.com/RSS.aspx?wealocations=wc:VMXX0006&weadegreetype=C');
$url_desc = array('London', 'New York', 'Tokyo', 'Hanoi');
function RemoveLinks($strlist)
{
//remove all links
$count = 0;
while($count < strlen($strlist))
{
if(substr($strlist, $count, strlen('
while(substr($strlist, $count, strlen('')) != '')
$count++;
$count += strlen('');
}
$output .= substr($strlist, $count, 1);
$count++;
}
return $output;
}
function DisabledLinks($strlist)
{
$count = 0;
while($count < strlen($strlist))
{
if(substr($strlist, $count, strlen('
while(substr($strlist, $count, strlen('>')) != '>')
$count++;
$count += strlen('>');
}
$output .= substr($strlist, $count, 1);
$count++;
}
$output = ereg_replace('', '', $output);
return $output;
}
function RemoveMSN($strlist)
{
$output = ereg_replace('
More information at MSN Weather', '', $strlist);
$output = ereg_replace('Powered by Foreca', '', $output);
$output = substr($output, 0, strlen($output) - 2);
return $output;
}
for($i = 0; $i < count($url); $i++)
{
$rss = fetch_rss($url[$i]);
if($rss)
{
$items = array_slice($rss->items, 0, 10);
$weather_info[$i][0] = $items[0]['description'];
$weather_info[$i][1] = $items[1]['description'];
//remove
', '', $weather_info[$i][0]); $weather_info[$i][1] = ereg_replace('
', '', $weather_info[$i][1]); $weather_info[$i][0] = ereg_replace('
', '', $weather_info[$i][0]); $weather_info[$i][1] = ereg_replace('', '', $weather_info[$i][1]); //remove tag $weather_info[$i][0] = ereg_replace('', '', $weather_info[$i][0]); $weather_info[$i][1] = ereg_replace('', '', $weather_info[$i][1]); $weather_info[$i][0] = ereg_replace('', '', $weather_info[$i][0]); $weather_info[$i][1] = ereg_replace('', '', $weather_info[$i][1]); $weather_info[$i][0] = RemoveLinks($weather_info[$i][0]); $weather_info[$i][1] = DisabledLinks($weather_info[$i][1]); $weather_info[$i][1] = RemoveMSN($weather_info[$i][1]); } else { echo magpie_error() . "