方法1:
天气预报接口(中国天气网)
中国天气weather.com
http://m.weather.com.cn/data/101110101.html(六天预报)
http://www.weather.com.cn/data/sk/101110101.html(实时天气信息)
其中是城市的代码,获得城市代码进入
http://www.weather.com.cn
在搜索框上输入你要需要获得天气的城市,点击查询,即可在地址栏获得相应城市编号,然后替换
http://m.weather.com.cn/data/101110101.html
.Net 抓取页面内容 :
string url = "http://tool.chinaz.com/ip?ip=" + ip;
byte[] b = new WebClient().DownloadData(url);
string str = Encoding.UTF8.GetString(b);
右击项目 》添加WEB引用。。。
http://www.webxml.com.cn/WebServices/WeatherWebService.asmx
using.....
static void Main(string[] args)
{
WeatherWebService wws = new WeatherWebService();
string[] weatherArray = wws.getWeatherbyCityName("");
Console.WriteLine("{0}-{1}-{2}", weatherArray[6], weatherArray[7], weatherArray[8]);
Console.Read();
}
到此这篇天气预报接口 20天(天气预报链接)的文章就介绍到这了,更多相关内容请继续浏览下面的相关 推荐文章,希望大家都能在编程的领域有一番成就!
版权声明:
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若内容造成侵权、违法违规、事实不符,请将相关资料发送至xkadmin@xkablog.com进行投诉反馈,一经查实,立即处理!
转载请注明出处,原文链接:https://www.xkablog.com/qkl-jc/28344.html