稳定、快速、免费的 API 接口服务
用于查询某城市的天气
拥有非常全面的天气数据,可以根据IP查询
接口地址: https://api.52vmy.cn/api/query/tian
返回格式: JSON
请求方式: GET
请求示例: https://api.52vmy.cn/api/query/tian?city=北京市
接口定制: 点此加入用户群
默认QPS: 每2秒最多4次 携带Token可无视限制
接口备注:点击前往三日天气API
请求参数说明:
名称 | 必填 | 类型 | 说明 |
---|---|---|---|
city | 是 | string | 城市 |
ip | 否 | string | IP地址 |
type | 否 | string | 返回格式默认JSON可选text |
返回参数说明:
名称 | 类型 | 说明 |
---|---|---|
weather | string | 天气 |
degree | string | 温度 |
max_degree | string | 最高温度 |
min_degree | string | 最低温度 |
windn | string | 风向 |
windr | string | 风力 |
humidity | string | 湿度 |
precipitation | string | 降水概率 |
pressure | string | 气压 |
sunup | string | 日出时间 |
sunset | string | 日落时间 |
tips | string | 提示语 |
返回示例:
{ "code": 200, "msg": "成功", "data": { "city": "北京", "cityEnglish": "beijing", "temp": "14", "tempn": "10", "weather": "浮尘转扬沙", "wind": "北风转西北风", "windSpeed": "<3级", "time": "2025-03-26 08:00", "warning": { "windSpeed": "00", "wind": "森林火险", "color": "橙色", "warning": "北京市森防办发布森林火险橙色预警:预计3月26日至30日,本市将出现大风天气,气象条件不利,林区植被干燥,森林火险等级高,森林防火形势严峻。严禁携带火种进山入林,严禁野外用火。一旦发现森林火情,请及时拨打12119或119报警。(预警信息来源:国家预警信息发布中心)", "time": "2025-03-29 15:02:45" }, "current": { "city": "北京", "cityEnglish": "beijing", "humidity": "25%", "wind": "东北风", "windSpeed": "2级", "pressure": "994", "visibility": "14km", "weather": "多云", "weatherEnglish": "Cloudy", "temp": "16.9", "fahrenheit": "62.4", "tempn": "10", "air": "74", "air_pm25": "74", "date": "03月26日(星期三)", "time": "15:55" }, "living": [ { "name": "路况指数", "index": "干燥", "tips": "有沙尘,路面较干燥,注意行车安全。" }, { "name": "晨练指数", "index": "不宜", "tips": "有沙尘天气,请避免户外晨练。" }, { "name": "逛街指数", "index": "较不宜", "tips": "有沙尘,注意带口罩等防尘用品。" }, { "name": "空气污染扩散条件指数", "index": "很差", "tips": "气象条件不利于空气污染物扩散。" }, { "name": "舒适度指数", "index": "较不舒适", "tips": "空气质量较差,您会感到很不舒适。" }, { "name": "啤酒指数", "index": "较不适宜", "tips": "有些凉意,少量饮用常温啤酒。" }, { "name": "划船指数", "index": "不适宜", "tips": "天气不好,建议选择别的娱乐方式。" }, { "name": "太阳镜指数", "index": "非常必要", "tips": "白天出行建议佩戴有防风沙功能的太阳镜" }, { "name": "紫外线强度指数", "index": "最弱", "tips": "辐射弱,涂擦SPF8-12防晒护肤品。" }, { "name": "风寒指数", "index": "无", "tips": "温度未达到风寒所需的低温,稍作防寒准备即可。" }, { "name": "穿衣指数", "index": "较冷", "tips": "建议着厚外套加毛衣等服装。" }, { "name": "放风筝指数", "index": "不宜", "tips": "天气不好,不适宜放风筝。" }, { "name": "空调开启指数", "index": "较少开启", "tips": "体感舒适,不需要开启空调。" }, { "name": "钓鱼指数", "index": "不宜", "tips": "天气不好,不适宜垂钓。" }, { "name": "晾晒指数", "index": "不宜", "tips": "有沙尘,请尽量关好门窗在室内晾晒。" }, { "name": "感冒指数", "index": "较易发", "tips": "降温幅度较大,预防感冒。" }, { "name": "洗车指数", "index": "不宜", "tips": "扬沙或浮尘会给汽车蒙上灰尘。" }, { "name": "旅游指数", "index": "一般", "tips": "浮尘天气将影响能见度和空气质量。" }, { "name": "夜生活指数", "index": "较适宜", "tips": "只要您稍作准备就可以放心外出。" }, { "name": "心情指数", "index": "差", "tips": "漫天遍野的尘土,让人心情烦躁。" }, { "name": "约会指数", "index": "较不适宜", "tips": "建议尽量不要去室外约会。" }, { "name": "运动指数", "index": "较不宜", "tips": "有扬沙或浮尘,建议停止户外运动。" }, { "name": "过敏指数", "index": "易发", "tips": "应减少外出,外出需采取防护措施。" }, { "name": "美发指数", "index": "适宜", "tips": "空气干燥,建议使用滋润成分的护发素。" }, { "name": "雨伞指数", "index": "不带伞", "tips": "扬沙或浮尘天,无需带雨伞。" }, { "name": "防晒指数", "index": "弱", "tips": "涂抹8-12SPF防晒护肤品。" }, { "name": "化妆指数", "index": "保湿", "tips": "请选用中性保湿型霜类化妆品。" }, { "name": "中暑指数", "index": "无中暑风险", "tips": "天气不热,在炎炎夏日中十分难得,可以告别暑气漫漫啦~" }, { "name": "交通指数", "index": "很差", "tips": "有扬沙或浮尘,交通气象条件很差,尽量减少出行" }, { "name": "干燥指数", "index": "干燥", "tips": "气温偏高,空气干燥,皮肤水分流失较多,应预防可能出现的皮肤瘙痒等情况,涂抹高保湿补水的护肤品,不要穿紧身衣服。" } ] } }
PHP代码示例:
$city = $_GET["city"]; $ip = $_GET["ip"]; $type = $_GET["type"]; $url = "https://api.52vmy.cn/api/query/tian?city=".$city."&ip=".$ip."&type=".$type; echo file_get_contents($url);