首页 »  API接口 »  实用API »  天气预报

天气预报

浏览次数:57 次
📖 API文档
🧪 在线测试
⚠️ 错误码
💻 示例代码
接口地址
https://api.qqsuu.cn/api/dm-hqtiqnqi?city=上海市&type=1
请求方式
POST
返回格式
JSON
接口状态
异常 (HTTP 404) 上次检测:2026-05-17 16:29:55
更新时间
2026-04-13 08:34:45
📝 接口描述
实时及一周天气预报
📋 请求示例
【基础请求】
POST https://api.qqsuu.cn/api/dm-hqtiqnqi?city=上海市&type=1

【请求头】
Content-Type: application/json
Accept: application/json

【参数说明】
POST请求参数通过请求体传递(JSON格式):

请求体示例:
{
    "参数名1": "参数值1",
    "参数名2": "参数值2"
}

【调用示例】

# cURL
curl -X POST 'https://api.qqsuu.cn/api/dm-hqtiqnqi?city=上海市&type=1' \
  -H 'Content-Type: application/json' \
  -d '{"key":"value"}'

# JavaScript (Fetch)
fetch('https://api.qqsuu.cn/api/dm-hqtiqnqi?city=上海市&type=1', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' }
    body: JSON.stringify({ key: 'value' })
})
.then(res => res.json())
.then(data => console.log(data));

# PHP (cURL)
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.qqsuu.cn/api/dm-hqtiqnqi?city=上海市&type=1');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['key' => 'value']));
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>

# Python (requests)
import requests
url = 'https://api.qqsuu.cn/api/dm-hqtiqnqi?city=上海市&type=1'
response = requests.post(url, json={'key': 'value'})
print(response.json())
📤 真实返回示例
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>
📌 请求参数 (键值对)
📊 返回结果
点击"发起请求"查看返回数据
错误码说明
200请求成功
400请求参数错误
401未授权访问
403禁止访问
404接口不存在
500服务器内部错误
🔧 JavaScript (Fetch)
fetch('/api/proxy.php?url=https%3A%2F%2Fapi.qqsuu.cn%2Fapi%2Fdm-hqtiqnqi%3Fcity%3D%E4%B8%8A%E6%B5%B7%E5%B8%82%26type%3D1', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' }
})
.then(res => res.json())
.then(data => console.log(data))
.catch(err => console.error(err));
🐘 PHP (cURL)
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.qqsuu.cn/api/dm-hqtiqnqi?city=上海市&type=1');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
📡 Python (requests)
import requests
url = 'https://api.qqsuu.cn/api/dm-hqtiqnqi?city=上海市&type=1'
response = requests.request('POST', url)
print(response.json())

同类推荐

🔥 同分类下热门接口