基本信息
| 接口地址 |
|
| 请求方式 | GET/POST |
| 返回格式 | JSON |
| 调用权限 | 公开/免费 |
请求参数说明
| 参数名 | 必填 | 类型 | 说明 | 示例值 |
|---|---|---|---|---|
| city | 必填 | string | 需要填的城市名 | 武清区 |
调用示例
PHP cURL
$url = 'https://api.bugpk.com/api/weather';
$params = [
'key' => 'value' // 请替换实际参数
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url . '?' . http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
返回结果示例
JSON Response
{
"code": 200,
"message": "获取成功!",
"date": 20250709,
"time": "2025-07-09 22:22:19",
"cityInfo": {
"city": "武清区",
"citykey": 101030200,
"parent": "天津市",
"updateTime": "17:55"
},
"data": {
"shidu": "64%",
"pm25": 14,
"pm10": 19,
"quality": "优",
"wendu": 31.5,
"ganmao": "各类人群可自由活动",
"forecast": [
{
"date": 9,
"high": "高温 33℃",
"low": "低温 24℃",
"ymd": "2025-07-09",
"week": "星期三",
"sunrise": "04:53",
"sunset": "19:40",
"aqi": 33,
"fx": "东南风",
"fl": "3级",
"type": "多云",
"notice": "阴晴之间,谨防紫外线侵扰"
},
{
"date": 10,
"high": "高温 37℃",
"low": "低温 24℃",
"ymd": "2025-07-10",
"week": "星期四",
"sunrise": "04:53",
"sunset": "19:40",
"aqi": 33,
"fx": "东南风",
"fl": "2级",
"type": "阴",
"notice": "不要被阴云遮挡住好心情"
},
{
"date": 11,
"high": "高温 38℃",
"low": "低温 24℃",
"ymd": "2025-07-11",
"week": "星期五",
"sunrise": "04:54",
"sunset": "19:40",
"aqi": 40,
"fx": "东南风",
"fl": "3级",
"type": "阴",
"notice": "不要被阴云遮挡住好心情"
},
{
"date": 12,
"high": "高温 38℃",
"low": "低温 25℃",
"ymd": "2025-07-12",
"week": "星期六",
"sunrise": "04:55",
"sunset": "19:39",
"aqi": 59,
"fx": "东南风",
"fl": "2级",
"type": "晴",
"notice": "愿你拥有比阳光明媚的心情"
},
{
"date": 13,
"high": "高温 39℃",
"low": "低温 25℃",
"ymd": "2025-07-13",
"week": "星期日",
"sunrise": "04:55",
"sunset": "19:39",
"aqi": 61,
"fx": "东北风",
"fl": "3级",
"type": "多云",
"notice": "阴晴之间,谨防紫外线侵扰"
},
{
"date": 14,
"high": "高温 38℃",
"low": "低温 25℃",
"ymd": "2025-07-14",
"week": "星期一",
"sunrise": "04:56",
"sunset": "19:38",
"aqi": 62,
"fx": "南风",
"fl": "2级",
"type": "多云",
"notice": "阴晴之间,谨防紫外线侵扰"
},
{
"date": 15,
"high": "高温 29℃",
"low": "低温 20℃",
"ymd": "2025-07-15",
"week": "星期二",
"sunrise": "04:57",
"sunset": "19:38",
"aqi": 36,
"fx": "东风",
"fl": "3级",
"type": "小雨",
"notice": "雨虽小,注意保暖别感冒"
},
{
"date": 16,
"high": "高温 33℃",
"low": "低温 20℃",
"ymd": "2025-07-16",
"week": "星期三",
"sunrise": "04:58",
"sunset": "19:37",
"aqi": 33,
"fx": "东北风",
"fl": "2级",
"type": "晴",
"notice": "愿你拥有比阳光明媚的心情"
},
{
"date": 17,
"high": "高温 33℃",
"low": "低温 22℃",
"ymd": "2025-07-17",
"week": "星期四",
"sunrise": "04:58",
"sunset": "19:37",
"aqi": 27,
"fx": "东南风",
"fl": "2级",
"type": "多云",
"notice": "阴晴之间,谨防紫外线侵扰"
},
{
"date": 18,
"high": "高温 34℃",
"low": "低温 21℃",
"ymd": "2025-07-18",
"week": "星期五",
"sunrise": "04:59",
"sunset": "19:36",
"aqi": 32,
"fx": "东南风",
"fl": "3级",
"type": "多云",
"notice": "阴晴之间,谨防紫外线侵扰"
},
{
"date": 19,
"high": "高温 33℃",
"low": "低温 23℃",
"ymd": "2025-07-19",
"week": "星期六",
"sunrise": "05:00",
"sunset": "19:35",
"aqi": 36,
"fx": "东北风",
"fl": "2级",
"type": "阴",
"notice": "不要被阴云遮挡住好心情"
},
{
"date": 20,
"high": "高温 33℃",
"low": "低温 23℃",
"ymd": "2025-07-20",
"week": "星期日",
"sunrise": "05:01",
"sunset": "19:35",
"aqi": 45,
"fx": "东南风",
"fl": "2级",
"type": "多云",
"notice": "阴晴之间,谨防紫外线侵扰"
},
{
"date": 21,
"high": "高温 31℃",
"low": "低温 24℃",
"ymd": "2025-07-21",
"week": "星期一",
"sunrise": "05:02",
"sunset": "19:34",
"aqi": 49,
"fx": "东北风",
"fl": "2级",
"type": "多云",
"notice": "阴晴之间,谨防紫外线侵扰"
},
{
"date": 22,
"high": "高温 34℃",
"low": "低温 25℃",
"ymd": "2025-07-22",
"week": "星期二",
"sunrise": "05:02",
"sunset": "19:33",
"aqi": 27,
"fx": "东南风",
"fl": "1级",
"type": "多云",
"notice": "阴晴之间,谨防紫外线侵扰"
},
{
"date": 23,
"high": "高温 28℃",
"low": "低温 26℃",
"ymd": "2025-07-23",
"week": "星期三",
"sunrise": "05:03",
"sunset": "19:32",
"aqi": 36,
"fx": "北风",
"fl": "2级",
"type": "阴",
"notice": "不要被阴云遮挡住好心情"
}
],
"yesterday": {
"date": 8,
"high": "高温 35℃",
"low": "低温 24℃",
"ymd": "2025-07-08",
"week": "星期二",
"sunrise": "04:52",
"sunset": "19:41",
"aqi": 30,
"fx": "东南风",
"fl": "3级",
"type": "多云",
"notice": "阴晴之间,谨防紫外线侵扰"
}
}
}
返回参数说明
| 参数名 | 类型 | 说明 | 示例 |
|---|---|---|---|
| code | string | 状态码 | |
| message | string | 提示信息 | |
| date | string | 日期 | |
| time | string | 时间 | |
| cityInfo | string | 城市信息 | |
| data | string | 近几天天气 | |
调试参数
响应结果
点击左侧"发送请求"查看结果...