稳定、快速、免费的 API 接口服务
获取百度图片
接口地址: https://wmkxz.cn/api/bdst
返回格式: JSON/TEXT
请求方式: GET/POST
请求示例: https://wmkxz.cn/api/bdst?msg=星许&type=json
所有接口需携带秘钥,以免更新导致请求失败!
请求参数说明:
名称 | 必填 | 类型 | 说明 |
---|---|---|---|
msg | 是 | string | 内容 |
type | 否 | string | json/text默认text |
返回参数说明:
名称 | 类型 | 说明 |
---|---|---|
imageurl | string | 图片链接 |
fromURLHost | string | 图片来源官网地址 |
FromURL | string | 图片来源详情 |
width | int | 高度 |
height | int | 宽度 |
type | string | 图片文件后缀 |
返回示例:
{ "code": 1, "listnum": 1642, "data": [ { "imageurl": "https://img2.baidu.com/it/u=3606127952,3372439326&fm=253&fmt=auto&app=138&f=JPEG?w=363&h=231", "fromURLHost": "aiqicha.baidu.com", "FromURL": "http://aiqicha.baidu.com/mark/s?q=%D0%C7%D0%ED", "width": 363, "height": 231, "type": "jpg" }, { "imageurl": "https://img2.baidu.com/it/u=4185447684,1600549024&fm=253&fmt=auto&app=120&f=JPEG?w=456&h=684", "fromURLHost": "weibo.com", "FromURL": "https://weibo.com/tv/show/1034:4997095757643888", "width": 480, "height": 720, "type": "jpg" }, { "imageurl": "https://img2.baidu.com/it/u=2917220942,269658812&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=889", "fromURLHost": "qin77015.lofter.com", "FromURL": "http://qin77015.lofter.com/post/1f21b2d9_1c9e25c44", "width": 1080, "height": 1920, "type": "jpg" }, { "imageurl": "https://img2.baidu.com/it/u=3863413608,2162655957&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=666", "fromURLHost": "huaban.com", "FromURL": "http://huaban.com/pins/3231105780/", "width": 658, "height": 877, "type": "jpg" }, { "imageurl": null, "fromURLHost": null, "FromURL": null, "width": null, "height": null, "type": null } ] }
错误码格式说明:
名称 | 类型 | 说明 |
---|---|---|
200 | string | 成功 |
201 | string | 失败 |
代码示例:
<?php
$apiUrl = 'https://wmkxz.cn/api/bdst';
$params = array(
'msg' => '星许',
'type' => 'json', //
'apiKey' => '你的密钥'
);
$queryString = http_build_query($params);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiUrl . '?' . $queryString);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if (curl_errno($ch)) {
$error_msg = curl_error($ch);
echo 'cURL Error: ' . $error_msg;
} else {
echo $response;
}
curl_close($ch);
?>