...

View Full Version : PHP Weather RSS Script



eararaldor
03-23-2007, 02:31 AM
I'm making this script which reads of the BBC RSS weather. Unfortunatly it currently isnt displaying anything. Have I got my nodes mixed up or somthing?

<?php

function xml_via_proxy ($url) {
$context = stream_context_create(
array('http'=>
array('proxy'=>'cache.uwe.ac.uk:8080')
));

$contents = file_get_contents($url, false, $context);
return simplexml_load_string($contents);

};

$weather = xml_via_proxy("http://feeds.bbc.co.uk/weather/feeds/rss/5day/world/0105.xml");

$description = $weather->rss->channel->item->description;


?>
<table border="1">
<h1>EALA</h1>
<tr><td>Description</td><td><?php print $description ?></td></tr>

</table>

iLLin
03-23-2007, 03:24 AM
I wish i had php 5 to use functions like that :p

eararaldor
03-23-2007, 03:26 AM
Dont wish to much, remmber this isnt working....
Thanks for bumping the thread anyway.

eararaldor
03-23-2007, 03:37 AM
Problem solved, just remove the rss->

Sometimes I really hate xml



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum