天气预报接口 20天(天气预报链接)

天气预报接口 20天(天气预报链接)p 方法 1 p 天气预报接口 中国天气网 中国天气 weather com http m weather com cn data 101110101 html 六天预报 http www weather com cn data sk 101110101 html amp

大家好,我是讯享网,很高兴认识大家。



 <p>方法1&#xff1a;</p> 

讯享网

天气预报接口(中国天气网)
中国天气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();
}

 

小讯
上一篇 2025-05-10 19:36
下一篇 2025-04-19 14:16

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/163600.html