Jump to content

PHP Weather RSS Script


eararaldor

Recommended Posts

I'm making this script which reads of the BBC RSS weather

 

<?php

/*

  Uses a REST-style interface to www.weather.com to display the current data in a location. 

 

*/

 

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>

 

Unfortunatly it currently isnt displaying anything. Have I got my nodes mixed up or somthing?

Link to comment
https://forums.phpfreaks.com/topic/43909-php-weather-rss-script/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.