获取天气预报代码 天气代码调用

这里的天气预报调用支持DIY样式,并支持IP显示天气,根据用户所在地显示当前天气预报!

://t.xidie/WeatherCode.aspx

样式挺多的。

ASP.NET实现天气预报

这是你想要的天气预报代码,由中央气象台提供数据,最准确最权威的天气预报,能够根据访客不同的IP地址显示不同城市的天气预报

下面是源程序代码:

&<iframe src="://.ttyyy/tianqi/tq.html" width="160" height="60" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"&>&</iframe&>

hao123网站左上的天气预报网页代码是什么?

using System;

using System.Data;

using System.Configuration;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using System.Data.SqlClient;

using System.Net;

using System.IO;

using System.Collections;

/// &<summary&>

/// Weather 的摘要说明

/// &</summary&>

public class Weather

{

public Weather()

{

//

// TODO: 在此处添加构造函数逻辑

//

}

public static string ConvertCodeByCity(string City)

{

string Code = "";

switch (City)

{

case "北京":

Code = "110100";

break;

default:

break;

}

return Code;

}

public static ArrayList GetWeather(string code)

{

/*

[0] "北京 "string

[1] "雷阵雨 "string

[2] "9℃" string

[3] "29℃"string

[4] "小于3级"string

*/

string html = "";

try

{

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("://weather.sina.cn/iframe/weather/" + code + "_w.html ");

request.Method = "Get";

//request.Timeout = 1;

request.ContentType = "lication/x--form-urlencoded ";

WebResponse response = request.GetResponse();

Stream s = response.GetResponseStream();

StreamReader sr = new StreamReader(s, System.Text.Encoding.GetEncoding("GB2312"));

html = sr.ReadToEnd();

s.Close();

sr.Close();

}

catch (Exception err)

{

throw new Exception("访问地址出错~~~ ");

}

int count = html.Length;

int starIndex = html.IndexOf("&<table ", 0, count);

int endIndex = html.IndexOf("&</table&>", starIndex, count - starIndex);

html = html.Substring(starIndex, endIndex - starIndex + 8);

//得到城市

int cityStartIndex = html.IndexOf("&<b&>", 0, html.Length);

int cityEndIndex = html.IndexOf("&</b&>", 0, html.Length);

string City = html.Substring(cityStartIndex + 3, cityEndIndex - cityStartIndex - 3);

//得到天气

int weatherStartIndex = html.IndexOf("&<b&>", cityEndIndex);

int weatherEndIndex = html.IndexOf("&</b&>", weatherStartIndex);

string Weather = html.Substring(weatherStartIndex + 3, weatherEndIndex - weatherStartIndex - 3);

//得到温度

int temperatureStartIndex = html.IndexOf("&<b", weatherEndIndex);

int temperatureEndIndex = html.IndexOf("&</b&>", weatherEndIndex + 3);

string Temperature = html.Substring(temperatureStartIndex + 21, temperatureEndIndex - temperatureStartIndex - 21);

int int1 = Temperature.IndexOf("℃", 0);

int int2 = Temperature.IndexOf("~", 0);

int int3 = Temperature.IndexOf("℃", int2);

string MinTemperature = Temperature.Substring(int2 + 1, int3 - int2);

string MaxTemperature = Temperature.Substring(0, int2 - int1 + 2);

//得到风力

int windforceStartIndex = html.IndexOf("风力:", temperatureEndIndex);

int windforceEndIndex = html.IndexOf("&<br&>", windforceStartIndex);

string Windforce = html.Substring(windforceStartIndex + 3, windforceEndIndex - windforceStartIndex - 3);

if (Windforce.Contains("小于") &&&& (!Windforce.Contains("等于"))) //判断风力是否含有"小于"或"小于等于"字样将,如果有的话,将其替换为2-

{

//Windforce = Windforce.Replace("小于", "2-");

string strWindforce = Windforce.Substring(2, Windforce.Length - 3);

int minWindforce = Int32.Parse(strWindforce) - 1;

Windforce = Windforce.Replace("小于", minWindforce.ToString() + "-");

}

else if (Windforce.Contains("小于等于"))

{

string strWindforce = Windforce.Substring(4, Windforce.Length - 5);

int minWindforce = Int32.Parse(strWindforce) - 1;

Windforce = Windforce.Replace("小于等于", minWindforce.ToString() + "-");

}

ArrayList al = new ArrayList();

al.Add(City);

al.Add(Weather);

al.Add(MinTemperature);

al.Add(MaxTemperature);

al.Add(Windforce);

return al;

}

}

谁帮我找一个天气预报网页代码

hao123网站左上的天气预报网页代码如下:

&<iframe src=

"://.tianqi123/small_page/chengshi_2250.html?

c0=red&&c1=D96C00&&bg=F4FFF4&&w=178&&h=20&&text=yes"?

width=178 height=21?

marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no?

align=center id=url&>&</iframe&>

制作网页时常用的代码有HTML,JaScript,ASP,PHP,CGI等,其中超文本标记语言(标准通用标记语言下的一个应用、外语简称:HTML)是最基础的网页代码。

扩展资料:

网页代码的一些简单使用:

&<marquee&>...&</marquee&>普通卷动

&<marquee behior=slide&>...&</marquee&>滑动

&<marquee behior=scroll&>...&</marquee&>预设卷动

&<marquee behior=alternate&>...&</marquee&>来回卷动

&<marquee direction=down&>...&</marquee&>向下卷动

&<h1&>...&</h1&>标题字(最大 )

&<h6&>...&</h6&>标题字(最小)

&<b&>...&</b&>粗体字

&<strong&>...&</strong&>粗体字(强调)

&<br&>(换行)

&<nobr&>...&</nobr&>水域(不换行)

&<p&>...&</p&>水域(段落)

&<center&>...&</center&>置中

百度百科-网页代码

联通手机怎麽开通天气预报的短信?

代码如下:

&<iframe id=weatherwin border=0 name=weatherwin marginWidth=0 marginHeight=0 src="://weather.369/weather.html" frameBorder=no width=160 scrolling=no height=60&>&</iframe&>

也可以用265的代码.在那里上网就显示那里的天气

如何通过发短信申请12121天气预报业务?

联通的手机天气预报业务主要有“早间天气”、“晚间天气”、“点播天气”等3种功能。手机天气预报的资费为2元包月。

开通方法亦十分便捷:用户编写短信“11”发送到10620121定制本地晚间(早间)天气业务;编写短信“11+城市区号(AM)”定制该城市晚间(早间)天气业务;编写短信“22”发送到10620121,即可点播本地最新天气预报;编写短信“22+城市区号”发送到10620121,即可点播该城市最新天气预报。

编写短信“11”发送到“1065570121”订制。

用户发送短信后,系统自动回复一条确认短信,通知客户订制成功。

注:现时能发送天气预报短信的只有禅城和顺德气象台。

用户发送短信代码到“1065570121”订制天气预报短信服务,系统将对“8”字头和“2”字头的小灵通进行区分。

凡“8”字头的小灵通默认订制禅城天气预报。

“2”字头小灵通默认订制顺德天气预报。

取消:编写短信“00”发送到“1065570121”,系统自动回复一条确认短信,通知客户取消成功。

扩展资料:

随着时代的发展,科技的进步,天气的变化与人们日常生活的衣食住行的关系越切。

“12121”气象信息电话自动答讯系统是由鄂州市气象台与湖北省电信公司鄂州分公司合作开通的。

系统用了先进的数字语音合成技术,具有语音清晰、内容丰富、全天服务的特点。

在服务内容上,更是体现了专业、全面、及时的特点,信息服务信箱内囊括了全国及省内150多个主要城市的天气预报和天气实况,并且还有与人们生活息息相关的各种生活气象指数。

本地逐小时的天气实况用的是本地气象自动观测站实时观测的最新探测资料。

12121天气预报更新时间表:

内容:更新时间。

各种气象预报晚 17:00。

如将出现重要的天气过程,将由我们的高级预报员随时作出订正预报,即时更新。

12121服务信箱内容。

键号内容:

1:鄂州市一周天气预报。

2:旅游景点天气预报。

3:国内主要城市天气预报。

4: 双休日及节日天气预报。

5:中国黄历。

6:气象与农事。

7:天文知识。

8 :生日档案查询。

9:天气预报短信息预定。

资费标准:市话费+0.6元/分钟的信息费(各地有所不同)。

参考资料:百度百科-12121

本文链接:http://www.frpt.cn/tqyb/27025.html
免责声明:文章由网友分享发布,并不意味本站赞同其观点,文章内容仅供参考。此文如侵犯到您的合法权益,请联系我们立刻删除。