| 参数名称 | 类型 | 必填 | 说明 | 
|---|---|---|---|
| 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.binstd.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 | 接口已停用 | 
| 名称 | 权限 | 价格 | 
|---|
开通账号: