当前位置:网站首页 > 区块链基础 > 正文

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



方法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天(天气预报链接)的文章就介绍到这了,更多相关内容请继续浏览下面的相关 推荐文章,希望大家都能在编程的领域有一番成就!

版权声明


相关文章:

  • a标签打开新窗口不跳转到新窗口怎么办(a标签在新窗口打开链接添加什么属性)2026-01-20 20:27:06
  • 二维码跳转链接制作(二维码跳转二维码)2026-01-20 20:27:06
  • 单向链表逆序(单向链表逆置)2026-01-20 20:27:06
  • 如何设置返回目录超链接(怎样做excel目录超链接和返回目录)2026-01-20 20:27:06
  • 短链接防红跳转(防红短链接生成器)2026-01-20 20:27:06
  • cp1200链接电脑(cp1200怎么用)2026-01-20 20:27:06
  • a标签 打开新窗口(a标签在新窗口打开链接添加什么属性)2026-01-20 20:27:06
  • 单向链表的基本操作(单向链表的基本操作有哪些)2026-01-20 20:27:06
  • b站怎么在视频里加跳转链接(b站怎么在视频上放链接)2026-01-20 20:27:06
  • b站上的视频链接怎么打开(b站怎么获取视频链接)2026-01-20 20:27:06
  • 全屏图片