Jump to content
xisto Community
Sign in to follow this  
contactskn

How To Display Temperature Of Any State Or Locality In Our Website?

Recommended Posts

Dear friends I would like to display the temperature and other related information of any selected city in my website. Is this possible for free then please give the link or process to accomplish the same. Thanking you all in advance.

Share this post


Link to post
Share on other sites

There are many widgets from multiple sites. Yahoo does have API that allow you to do this. If you have asp/php based site then chances are that you'll able to put the yahoo weather widget on your site. Other than that find scripts on the internet that let's you put weather widget on your site or blog. I'll update this thread as i get the scripts that can serve your purpose.

Share this post


Link to post
Share on other sites

Here's an old PHP function of mine from an old, dead script i have lying around:

function make_well_formed($matches){	$matches[0] = str_replace("<![CDATA[", "", $matches[0]);	$matches[0] = str_replace("]]>", "", $matches[0]);	$matches[0] = str_replace("&", "&", $matches[0]);	$matches[0] = preg_replace("/<br ?\/>/i", "", $matches[0]);	return str_replace(":", "_", $matches[0]);}	function applet_xml_object($xml_src){		$xml = file_get_contents($xml_src);		$xml = preg_replace_callback("/(<\/?\w+:.+\/?>|<!\[CDATA\[|\]\]>|<[bB][rR] ?\/>|&)/", "make_well_formed", $xml);		$xml = simplexml_load_string($xml);		return $xml;	}	function yahoo_weather_applet($zipcode){		if (is_numeric($zipcode)){			$xml = $this->applet_xml_object("http://forums.xisto.com/no_longer_exists/);			$output = "<div>			<p align=\"center\" style=\"vertical-align: middle; display: table-cell; width: 200px; height: 140px;\">			<img src=\"".$xml->channel->item->description->img['src']."\" alt=\"".$xml->channel->image->title."\" align=\"center\"/><br/>			<b style=\"font-size: 22px;\">".$xml->channel->item->yweather_condition['text']."</b>			</p>			<p style=\"vertical-align: middle; display: table-cell; width: 200px;\">			<i>".$xml->channel->item->pubDate."</i><br/>			<b>Temperature:</b> ".$xml->channel->item->yweather_condition['temp']."°".$xml->channel->yweather_units['temperature']."<br/>			<b>Barometer:</b> ".$xml->channel->yweather_atmosphere['pressure']." ".$xml->channel->yweather_units['pressure']."<br/>			<b>Humidity:</b> ".$xml->channel->yweather_atmosphere['humidity']."%<br/>			<b>Visibility:</b> ".$xml->channel->yweather_atmosphere['visibility']." ".$xml->channel->yweather_units['distance']."<br/>			<b>Wind:</b> ".$xml->channel->yweather_wind['speed']." ".$xml->channel->yweather_units['speed']."<br/>			<b>Wind Direction:</b> ".$xml->channel->yweather_wind['direction']."°			</p>			</div>			<div>			<p style=\"display: table-cell; width: 200px; padding-left: 10px;\">			<i style=\"font-size: 16px;\">Forecast (".$xml->channel->item->yweather_forecast->{0}['day'].")</i><br/>			<b>".$xml->channel->item->yweather_forecast->{0}['text']."</b><br/>			<b>High:</b> ".$xml->channel->item->yweather_forecast->{0}['high']."°".$xml->channel->yweather_units['temperature'].";			<b>Low:</b> ".$xml->channel->item->yweather_forecast->{0}['low']."°".$xml->channel->yweather_units['temperature'].";			</p>			<p style=\"display: table-cell; width: 200px; border-left: 1px solid black; padding-left: 10px;\">			<i style=\"font-size: 16px;\">Forecast (".$xml->channel->item->yweather_forecast->{1}['day'].")</i><br/>			<b>".$xml->channel->item->yweather_forecast->{1}['text']."</b><br/>			<b>High:</b> ".$xml->channel->item->yweather_forecast->{1}['high']."°".$xml->channel->yweather_units['temperature'].";			<b>Low:</b> ".$xml->channel->item->yweather_forecast->{1}['low']."°".$xml->channel->yweather_units['temperature'].";			</p>			</div>";			return $this->create_applet("yahoo_weather", "yahoo_weather_applet", str_replace("'", "\'", $xml->channel->title), "update_yahoo_weather(".$zipcode.");", $output, 1);		} else {		return "<div></div>";		}	}

The parameter should be self explanatory. Since you're a programmer yourself, i wouldn't expect you to have any trouble reading this.

Share this post


Link to post
Share on other sites

if i were you, i would pm "echo_of_thunder". he probably has any answers you are looking for...

 

Dear friends I would like to display the temperature and other related information of any selected city in my website. Is this possible for free then please give the link or process to accomplish the same. Thanking you all in advance.

Share this post


Link to post
Share on other sites

I just found the widget site about which i told you earlier. You can check widgeo.net site. This site has multiple widgets. There is also weather widget. I think this is what you're looking for. Check it out. Let me know if this is what you want or not.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.