Forum Moderators: coopster

Message Too Old, No Replies

PHP and RSS for Weather

         

mkingsle

10:33 pm on Mar 20, 2008 (gmt 0)

10+ Year Member



Hi everyone:

I've been looking around the internet for a good and simple php script to get weather from Yahoo on my site. Just a simple blurb about the temp. is all I need to put up top my website. Anyone know of a good php script for that using their RSS feed?

Thanks,

Michael

eelixduppy

12:32 am on Mar 21, 2008 (gmt 0)



a quick search at [phpclasses.org...] gave me the following: [phpclasses.org...]

I personally haven't used it but it seems legit. If this isn't what you are looking for, it shouldn't be too hard to implement your own, especially if you have php 5 available to you.

mkingsle

6:17 pm on Mar 21, 2008 (gmt 0)

10+ Year Member



You mentioned php5 and I do in fact have it. I currently use it for Amazon xml, but want to branch out into other types of xml uses. If you have any tips on how to implement my own, it would be greatly appreciated.

Michael

eelixduppy

11:05 pm on Mar 21, 2008 (gmt 0)



It's very simple if you use SimpleXML [php.net]. Here is a very quick example:

$xml = new SimpleXMLElement(file_get_contents("http://weather.yahooapis.com/forecastrss?p=07070"));
echo 'Description: '.$xml->channel->description.'<br/><br/>';
echo $xml->channel->item->description;

Read the information posted at the link I have provided you above for more information on how to work with simplexml.

mkingsle

5:48 pm on Mar 26, 2008 (gmt 0)

10+ Year Member



Thanks for the help. I will look at this more.

Thanks again.