Codeasearch.com - Search your code with us Login | Register | Contact us
  Forums > Php > Simple way to access weather forecast from yahoo api
benaya
Posted on Feb 19, 2009
Join Date: June 2007
Location: India ( Chennai )
Posts: 90
 
Simple way to access weather forecast from yahoo api  

<?php
// Accessing yahoo weather api for chennai weather
if($objXml = simplexml_load_file(`http://weather.yahooapis.com/forecastrss?p=INXX0202&u=c`)) {

// Getting description which display image, conditions and forecast
$arry = split("<br />",str_replace("<BR />","<br />",$objXml->channel->item->description));

// Embeding title and description
$strString = $objXml->channel->item->title."<br />".$arry[0]."<br />".$arry[1]."<br />".$arry[2]."<br />".$arry[3];
echo $strString;
}
?>

Find rss for your country with below link
http://weather.yahoo.com/

 Hot Discussion
Go Tech launches Android tablet for Rs 3,999...
Sony targets retailers with quick sales pitches and rew...
Share and discover new activities with Google Schemer...
Samsung gets 9 mn preorders for Galaxy S3: Report...
Google revamps search engine to think like a person...
 
 Discussion Topics
IT News
Php
Javascript
Technology Updates
Asp.Net
MySql
Ajax
Html
Fedora
Software Testing
Asp
Java
General
Flash
Ruby on Rails