| 参数名称 | 类型 | 必填 | 说明 |
|---|---|---|---|
| city | string | 否 | 城市 |
| cityid | int | 否 | 城市ID |
| date | string | 是 | 日期 默认为昨天 格式为:2018-01-01 |
| 参数名称 | 类型 | 说明 |
|---|---|---|
| cityid | int | 城市ID |
| cityname | string | 城市 |
| date | string | 日期 |
| weather | string | 天气 |
| temphigh | string | 最高气温 |
| templow | string | 最低气温 |
| img | string | 图片数字 |
| humidity | string | 湿度 |
| pressure | string | 气压 |
| windspeed | string | 风速 |
| windpower | string | 风级 |
| sunrise | string | 日出时间 |
| sunset | string | 日落时间 |
| aqi | string | AQI指数 |
| primarypollutant | string | 首要污染物 |
<?php
require_once 'curl.func.php';
$appkey = 'your_appkey_here';//你的appkey
$city = '安顺';//utf8
$cityid='111';//任选
$url = "https://api.jisuapi.com/weather2/query?appkey=$appkey&city=$city";
$result = curlOpen($url, ['ssl'=>true]);
$jsonarr = json_decode($result, true);
//exit(var_dump($jsonarr));
if($jsonarr['status'] != 0)
{
echo $jsonarr['msg'];
exit();
}
$result = $jsonarr['result'];
echo $result['cityid'].' '.$result['date'].' '.$result['weather'].' '.$result['temphigh'].' '.$result['templow'].' '.$result['img'].' '.$result['humidity'].' '.$result['pressure'].' '.$result['windspeed'].' '.$result['winddirect'].' '.$result['windpower'].' '.$result['sunrise'].' '.$result['sunset'].' '.$result['aqi'].' '.$result['primarypollutant'].' '.$result['cityname'];
{
"status": 0,
"msg": "ok",
"result": {
"cityid": "111",
"date": "2018-01-01",
"weather": "阴",
"temphigh": "8",
"templow": "4",
"img": "2",
"humidity": "98",
"pressure": "856",
"windspeed": "1.8",
"winddirect": "东风",
"windpower": "2级",
"sunrise": "07:44",
"sunset": "18:15",
"aqi": "29",
"primarypollutant": "PM10",
"cityname": "安顺"
}
}
| 代号 | 说明 |
|---|---|
| 201 | 城市和城市ID都为空 |
| 202 | 城市不存在 |
| 203 | 查询日期为空 |
| 204 | 日期格式不正确 |
| 210 | 没有信息 |
| 代号 | 说明 |
|---|---|
| 101 | APPKEY为空或不存在 |
| 102 | APPKEY已过期 |
| 103 | APPKEY无请求此数据权限 |
| 104 | 请求超过次数限制 |
| 105 | IP被禁止 |
| 106 | IP请求超过限制 |
| 107 | 接口维护中 |
| 108 | 接口已停用 |
| 计次套餐 | 套餐规格 | 价格 | ||
|---|---|---|---|---|
| 免费套餐 | 100次 | 0.00 元 | ≈0元/次 | |
| Level1 | 10000次 | 198.00 元 | ≈0.0198元/次 | |
| Level2 | 20000次 | 370.00 元 | ≈0.0185元/次 | |
| Level3 | 50000次 | 850.00 元 | ≈0.017元/次 | |
| Level4 | 100000次 | 1500.00 元 | ≈0.015元/次 | |
| * 包月套餐和计次套餐不可同时购买,不可叠加使用。 | ||||
| 包月套餐 | 套餐规格 | 价格 | ||
|---|---|---|---|---|
| Level2 特惠 | 3000次/天 | 305.00元 | ≈0.00339元/次 | |
| Level3 | 6000次/天 | 572.50元 | ≈0.00318元/次 | |
| Level4 | 10000次/天 | 880.00元 | ≈0.00293元/次 | |
| * 套餐使用时限为订购之日起30日。 | ||||


© 2015-2025 杭州极速互联科技有限公司 版权所有 浙ICP备17047587号-4 浙公网安备33010502005096 增值电信业务经营许可证:浙B2-20190875