浏览器版本低!无法浏览完整内容,建议升级或更换浏览器。
开始使用
行政区划区域检索
本示例为请求检索北京市内的银行ATM机
示例代码

https://api.map.baidu.com/place/v2/search?query=ATM机&tag=银行&region=北京&output=json&ak=您的ak
//GET请求

填写您的AK

输入AK可生成包含IP/SN校验方式的代码

<?php
// 此处填写你在控制台-应用管理-创建应用后获取的AK
$ak = '您的AK';
// 发起一个http get请求,并返回请求的结果
// $url字段为请求的地址
// $param字段为请求的参数
function request_get($url = '', $param = array()) {
if (empty($url) || empty($param)) {
return false;
}
$getUrl = $url . "?" . http_build_query($param);
$curl = curl_init(); // 初始化curl
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // 跳过证书检查
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); // 从证书中检查SSL加密算法是否存在
curl_setopt($curl, CURLOPT_URL, $getUrl); // 抓取指定网页
curl_setopt($curl, CURLOPT_TIMEOUT, 1000); // 设置超时时间1秒
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // curl不直接输出到屏幕
curl_setopt($curl, CURLOPT_HEADER, 0); // 设置header
$data = curl_exec($curl); // 运行curl
if (!$data) {
print("an error occured in function request_get(): " . curl_error($curl) . "\n");
}
curl_close($curl);
return $data;
}
// 请求地址
$url = 'https://api.map.baidu.com/place/v2/search';
// 构造请求参数
$param['query'] = 'ATM机';
$param['tag'] = '银行';
$param['region'] = '北京';
$param['output'] = 'json';
$param['ak'] = $ak;
$res = request_get($url, $param);
// 将原始返回的结果打印出来
print("请求的原始返回结果为:\n");
print($res . "\n");
?>
{
"status": 0,
"message": "ok",
"result_type": "poi_type",
"results": [
{
"name": "中国工商银行24小时自助银行(北京府学路支行)",
"location": {
"lat": 40.227332,
"lng": 116.263379
},
"address": "北京市昌平区府学路福地家园7号楼07号1-2层",
"province": "北京市",
"city": "北京市",
"area": "昌平区",
"street_id": "22e11407287926b4d5b74e09",
"detail": 1,
"uid": "22e11407287926b4d5b74e09"
},
{
"name": "中国工商银行24小时自助银行(北京分行中关村支行丰慧中路店)",
"location": {
"lat": 40.08189,
"lng": 116.242144
},
"address": "丰慧中路7号",
"province": "北京市",
"city": "北京市",
"area": "海淀区",
"street_id": "dd33b83a0f8c6f55ab175a1f",
"detail": 1,
"uid": "dd33b83a0f8c6f55ab175a1f"
},
{
"name": "中国工商银行ATM(昌平支行)",
"location": {
"lat": 40.21018,
"lng": 116.244804
},
"address": "北京市昌平区科技园区超前路9号",
"province": "北京市",
"city": "北京市",
"area": "昌平区",
"street_id": "5508504dff802acbc7f0250d",
"detail": 1,
"uid": "5508504dff802acbc7f0250d"
},
{
"name": "招商银行24小时自助银行(立水桥支行)",
"location": {
"lat": 40.046176,
"lng": 116.421222
},
"address": "北京市朝阳区北苑路13号院1号楼1-9号",
"province": "北京市",
"city": "北京市",
"area": "朝阳区",
"street_id": "2e00c5ddfe1e6e62d6851f85",
"detail": 1,
"uid": "2e00c5ddfe1e6e62d6851f85"
},
{
"name": "中国建设银行24小时自助银行(北京昌平天通北苑支行)",
"location": {
"lat": 40.083388,
"lng": 116.420857
},
"address": "北京市昌平区东小口镇天通北苑一区甲4号楼3门(近地铁5号线天通苑站)",
"province": "北京市",
"city": "北京市",
"area": "昌平区",
"street_id": "ea4a3dc98279772e4e55471c",
"detail": 1,
"uid": "ea4a3dc98279772e4e55471c"
},
{
"name": "中国建设银行ATM(北京昌平回龙观支行)",
"location": {
"lat": 40.09399,
"lng": 116.350631
},
"address": "北京市昌平区龙回苑28号",
"province": "北京市",
"city": "北京市",
"area": "昌平区",
"street_id": "750368359a2e38af5e0d021b",
"detail": 1,
"uid": "750368359a2e38af5e0d021b"
},
{
"name": "招商银行24小时自助银行(回龙观支行)",
"location": {
"lat": 40.085153,
"lng": 116.344808
},
"address": "北京市昌平区龙冠商务中心1层",
"province": "北京市",
"city": "北京市",
"area": "昌平区",
"street_id": "5165c94b870f3ec5d92f289b",
"detail": 1,
"uid": "5165c94b870f3ec5d92f289b"
},
{
"name": "招商银行24小时自助银行服务(望京融科支行)",
"location": {
"lat": 40.003785,
"lng": 116.489532
},
"address": "北京市朝阳区望京东园523号融科望京中心A座101号",
"province": "北京市",
"city": "北京市",
"area": "朝阳区",
"street_id": "647a352e9bbbaa226268580a",
"detail": 1,
"uid": "647a352e9bbbaa226268580a"
},
{
"name": "中国工商银行24小时自助银行(北新桥支行)",
"location": {
"lat": 39.949826,
"lng": 116.423466
},
"address": "北京市东城区雍和宫大街52号",
"province": "北京市",
"city": "北京市",
"area": "东城区",
"street_id": "4a152d0030a8dc15f4b916d6",
"detail": 1,
"uid": "4a152d0030a8dc15f4b916d6"
},
{
"name": "中国工商银行24小时自助银行服务(京奥嘉园支行)",
"location": {
"lat": 39.966871,
"lng": 116.552054
},
"address": "东坝乡京奥家园186幢1-2号",
"province": "北京市",
"city": "北京市",
"area": "朝阳区",
"street_id": "f757e6eee5b37817260bd043",
"detail": 1,
"uid": "f757e6eee5b37817260bd043"
}
]
}
在线运行
参数备注必选
query
检索关键字。行政区划区域检索不支持多关键字检索。如果需要按POI分类进行检索,请将分类通过query参数进行设置,如query=美食
tag
检索分类偏好,与query组合进行检索,多个分类以","分隔 (POI分类),如果需要严格按分类检索,请通过query参数设置
region
检索行政区划区域(增加区域内数据召回权重,如需严格限制召回数据在区域内,请搭配使用city_limit参数),可输入行政区划名或对应cityCode
output
输出格式为json或者xml
圆形区域检索
设置圆心和半径,检索圆形区域内的地点信息(常用于周边检索场景)。
示例代码

https://api.map.baidu.com/place/v2/search?query=银行&location=39.915,116.404&radius=2000&output=json&ak=您的密钥
//GET请求

填写您的AK

输入AK可生成包含IP/SN校验方式的代码

<?php
// 此处填写你在控制台-应用管理-创建应用后获取的AK
$ak = '您的AK';
// 发起一个http get请求,并返回请求的结果
// $url字段为请求的地址
// $param字段为请求的参数
function request_get($url = '', $param = array()) {
if (empty($url) || empty($param)) {
return false;
}
$getUrl = $url . "?" . http_build_query($param);
$curl = curl_init(); // 初始化curl
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // 跳过证书检查
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); // 从证书中检查SSL加密算法是否存在
curl_setopt($curl, CURLOPT_URL, $getUrl); // 抓取指定网页
curl_setopt($curl, CURLOPT_TIMEOUT, 1000); // 设置超时时间1秒
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // curl不直接输出到屏幕
curl_setopt($curl, CURLOPT_HEADER, 0); // 设置header
$data = curl_exec($curl); // 运行curl
if (!$data) {
print("an error occured in function request_get(): " . curl_error($curl) . "\n");
}
curl_close($curl);
return $data;
}
// 请求地址
$url = 'https://api.map.baidu.com/place/v2/search';
// 构造请求参数
$param['query'] = '银行';
$param['location'] = '39.915,116.404';
$param['radius'] = '2000';
$param['output'] = 'json';
$param['ak'] = $ak;
$res = request_get($url, $param);
// 将原始返回的结果打印出来
print("请求的原始返回结果为:\n");
print($res . "\n");
?>
{
"status": 0,
"message": "ok",
"result_type": "poi_type",
"results": [
{
"name": "原麦加利银行",
"location": {
"lat": 39.908609,
"lng": 116.406868
},
"address": "北京市东城区东交民巷39号",
"province": "北京市",
"city": "北京市",
"area": "东城区",
"detail": 0,
"uid": "2bbad00161fcd2c488b9886e"
},
{
"name": "中国民生银行(北京正义路支行)",
"location": {
"lat": 39.915492,
"lng": 116.413403
},
"address": "北京市东城区南河沿大街109号",
"province": "北京市",
"city": "北京市",
"area": "东城区",
"telephone": "(010)65284468",
"detail": 0,
"uid": "14cf81e3aae18d1914948ebb"
},
{
"name": "西交民巷近代银行建筑群",
"location": {
"lat": 39.908018,
"lng": 116.398341
},
"address": "北京市西城区西交民巷56号",
"province": "北京市",
"city": "北京市",
"area": "西城区",
"detail": 0,
"uid": "4eea5ab87122e5673913fd73"
},
{
"name": "北京银行(前门文创支行)",
"location": {
"lat": 39.906034,
"lng": 116.401313
},
"address": "北京市西城区前门西大街正阳市场西区1号楼",
"province": "北京市",
"city": "北京市",
"area": "西城区",
"telephone": "(010)63048577",
"detail": 0,
"uid": "be2d09340d0b5c0035b06c31"
},
{
"name": "北京银行24小时自助银行服务",
"location": {
"lat": 39.906015,
"lng": 116.401328
},
"address": "前门西大街正阳市场1号",
"province": "北京市",
"city": "北京市",
"area": "西城区",
"detail": 0,
"uid": "b8e797b2ccc5db8ccb2915f0"
},
{
"name": "中国工商银行(北京王府井东华门支行)",
"location": {
"lat": 39.921361,
"lng": 116.411452
},
"address": "北京市东城区东华门大街20号",
"province": "北京市",
"city": "北京市",
"area": "东城区",
"telephone": "(010)65125921",
"detail": 0,
"uid": "1d19b31063fc320183a00ca8"
},
{
"name": "北京银行文化创客中心",
"location": {
"lat": 39.906005,
"lng": 116.401277
},
"address": "北京市西城区前门西大街正阳市场1号楼北京银行前门支行2层",
"province": "北京市",
"city": "北京市",
"area": "西城区",
"detail": 0,
"uid": "05b5f25c148d7985b64f543c"
},
{
"name": "中国工商银行(北京正阳门支行)",
"location": {
"lat": 39.90649,
"lng": 116.40944
},
"address": "北京市东城区前门东大街16号",
"province": "北京市",
"city": "北京市",
"area": "东城区",
"telephone": "(010)67015791,(010)67016132",
"detail": 0,
"uid": "befdb2928aad85e186154199"
},
{
"name": "中国工商银行24小时自助银行(北京正阳门支行)",
"location": {
"lat": 39.906503,
"lng": 116.409473
},
"address": "北京市东城区前门东大街16号",
"province": "北京市",
"city": "北京市",
"area": "东城区",
"detail": 0,
"uid": "e6c265d1a03a8955d813189e"
},
{
"name": "中国工商银行离行式自助服务区(北京分行珠市口支行前门西大街)",
"location": {
"lat": 39.9072,
"lng": 116.396818
},
"address": "北京市西城区前门西大街41号",
"province": "北京市",
"city": "北京市",
"area": "西城区",
"detail": 0,
"uid": "7648c1b08a9301ba3904b15c"
}
]
}
在线运行
参数备注必选
query
检索关键字。行政区划区域检索不支持多关键字检索。如果需要按POI分类进行检索,请将分类通过query参数进行设置,如query=美食
location
圆形区域检索中心点,不支持多个点
38.76623,116.43213
lat<纬度>,lng<经度>
radius
圆形区域检索半径,单位为米。(增加区域内数据召回权重,如需严格限制召回数据在区域内,请搭配使用radius_limit参数),当半径过大,超过中心点所在城市边界时,会变为城市范围检索,检索范围为中心点所在城市
output
输出格式为json或者xml
多边形区域检索
开发者可使用多边形区域检索传入多个坐标对,首尾坐标对需相同,坐标对用”,”分割;多边形为矩形时,可传入左上右下两顶点坐标对。即可获取地点(POI)基础或详细地理信息。
示例代码

http://api.map.baidu.com/place/v2/search?query=银行&bounds=39.915,116.404,39.975,116.414&output=json&ak=您的密钥
//GET请求

填写您的AK

输入AK可生成包含IP/SN校验方式的代码

<?php
// 此处填写你在控制台-应用管理-创建应用后获取的AK
$ak = '您的AK';
// 发起一个http get请求,并返回请求的结果
// $url字段为请求的地址
// $param字段为请求的参数
function request_get($url = '', $param = array()) {
if (empty($url) || empty($param)) {
return false;
}
$getUrl = $url . "?" . http_build_query($param);
$curl = curl_init(); // 初始化curl
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // 跳过证书检查
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); // 从证书中检查SSL加密算法是否存在
curl_setopt($curl, CURLOPT_URL, $getUrl); // 抓取指定网页
curl_setopt($curl, CURLOPT_TIMEOUT, 1000); // 设置超时时间1秒
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // curl不直接输出到屏幕
curl_setopt($curl, CURLOPT_HEADER, 0); // 设置header
$data = curl_exec($curl); // 运行curl
if (!$data) {
print("an error occured in function request_get(): " . curl_error($curl) . "\n");
}
curl_close($curl);
return $data;
}
// 请求地址
$url = 'https://api.map.baidu.com/place/v2/search';
// 构造请求参数
$param['query'] = '银行';
$param['bounds'] = '39.915,116.404,39.975,116.414';
$param['output'] = 'json';
$param['ak'] = $ak;
$res = request_get($url, $param);
// 将原始返回的结果打印出来
print("请求的原始返回结果为:\n");
print($res . "\n");
?>
{
"status": 0,
"message": "ok",
"result_type": "poi_type",
"results": [
{
"name": "中国工商银行(北京地坛支行)",
"location": {
"lat": 39.966729,
"lng": 116.413804
},
"address": "北京市东城区安定门外大街9号",
"province": "北京市",
"city": "北京市",
"area": "东城区",
"street_id": "50f7d1461f0208c472210bff",
"telephone": "(010)84122100",
"detail": 1,
"uid": "50f7d1461f0208c472210bff",
"status": ""
},
{
"name": "北京银行(中轴路支行)",
"location": {
"lat": 39.957608,
"lng": 116.404181
},
"address": "北京市东城区安德路16号",
"province": "北京市",
"city": "北京市",
"area": "东城区",
"street_id": "33ddf832c2d7244952e5c51e",
"telephone": "(010)84882626",
"detail": 1,
"uid": "33ddf832c2d7244952e5c51e",
"status": ""
},
{
"name": "北京银行(沙滩支行)",
"location": {
"lat": 39.929113,
"lng": 116.412448
},
"address": "北京市东城区北河沿大街97号",
"province": "北京市",
"city": "北京市",
"area": "东城区",
"street_id": "9ca676f2a814373a43e19275",
"telephone": "95526",
"detail": 1,
"uid": "9ca676f2a814373a43e19275",
"status": ""
},
{
"name": "交通银行(北京和平里支行)",
"location": {
"lat": 39.96878,
"lng": 116.410023
},
"address": "北京市朝阳区外馆东街51号",
"province": "北京市",
"city": "北京市",
"area": "朝阳区",
"street_id": "e56bf5e3064b7b440782c2ff",
"telephone": "(010)64408115",
"detail": 1,
"uid": "e56bf5e3064b7b440782c2ff",
"status": ""
},
{
"name": "中国银行(安定门外支行)",
"location": {
"lat": 39.958013,
"lng": 116.413657
},
"address": "北京市东城区安外大街191号",
"province": "北京市",
"city": "北京市",
"area": "东城区",
"street_id": "f4460918f2b3296ab11e36ff",
"telephone": "(010)64400221",
"detail": 1,
"uid": "f4460918f2b3296ab11e36ff",
"status": ""
},
{
"name": "中国民生银行(北京安定门支行)",
"location": {
"lat": 39.971308,
"lng": 116.41372
},
"address": "北京市朝阳区安定门外大街1号",
"province": "北京市",
"city": "北京市",
"area": "朝阳区",
"street_id": "53cebd509fbca9612a02e14c",
"telephone": "(010)58295666",
"detail": 1,
"uid": "53cebd509fbca9612a02e14c",
"status": "暂停营业"
},
{
"name": "中国进出口银行(北京分行)",
"location": {
"lat": 39.934787,
"lng": 116.412091
},
"address": "北京市东城区北河沿大街77号",
"province": "北京市",
"city": "北京市",
"area": "东城区",
"street_id": "6334ddeb6a99710bfea77863",
"telephone": "(010)64099688",
"detail": 1,
"uid": "6334ddeb6a99710bfea77863",
"status": ""
},
{
"name": "中国民生银行(什刹海支行)",
"location": {
"lat": 39.939677,
"lng": 116.411715
},
"address": "北京市东城区地安门东大街56号",
"province": "北京市",
"city": "北京市",
"area": "东城区",
"street_id": "6151f789e113de3cfda778e3",
"telephone": "(010)83281583,95568",
"detail": 1,
"uid": "6151f789e113de3cfda778e3",
"status": ""
},
{
"name": "中国工商银行(北京和平北路东口支行)",
"location": {
"lat": 39.96859,
"lng": 116.410324
},
"address": "北京市朝阳区外馆东街51号凯景铭座一层",
"province": "北京市",
"city": "北京市",
"area": "朝阳区",
"street_id": "4482d48423f9a3b33fe23125",
"telephone": "(010)84123118",
"detail": 1,
"uid": "4482d48423f9a3b33fe23125",
"status": ""
},
{
"name": "中国民生银行(北京正义路支行)",
"location": {
"lat": 39.915492,
"lng": 116.413403
},
"address": "北京市东城区南河沿大街109号",
"province": "北京市",
"city": "北京市",
"area": "东城区",
"street_id": "14cf81e3aae18d1914948ebb",
"telephone": "(010)65284468",
"detail": 1,
"uid": "14cf81e3aae18d1914948ebb",
"status": ""
}
]
}
在线运行
参数备注必选
query
检索关键字。多边形区域内检索支持多个关键字并集检索,不同关键字间以$符号分隔,最多支持10个关键字检索,如:银行$酒店。如果需要按POI分类进行检索,请将分类通过query参数进行设置,如query=美食
bounds
检索多边形区域。需传入多个坐标对集合,坐标对用','分割,首尾坐标对需相同。多边形为矩形时,可传入左下右上两顶点坐标对。
output
输出格式为json或者xml
地点详情检索
不同于其他三种检索功能。地点详情检索针对指定POI,检索其相关的详情信息。开发者可以通过三种区域检索(或其他服务)功能,获取POI uid。使用“地点详情检索”功能,传入uid,即可检索POI详情信息,如评分、营业时间等(不同类型POI对应不同类别详情数据)。
示例代码

https://api.map.baidu.com/place/v2/detail?uid=435d7aea036e54355abbbcc8&output=json&scope=2&ak=您的密钥
//GET请求

填写您的AK

输入AK可生成包含IP/SN校验方式的代码

<?php
// 此处填写你在控制台-应用管理-创建应用后获取的AK
$ak = '您的AK';
// 发起一个http get请求,并返回请求的结果
// $url字段为请求的地址
// $param字段为请求的参数
function request_get($url = '', $param = array()) {
if (empty($url) || empty($param)) {
return false;
}
$getUrl = $url . "?" . http_build_query($param);
$curl = curl_init(); // 初始化curl
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // 跳过证书检查
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); // 从证书中检查SSL加密算法是否存在
curl_setopt($curl, CURLOPT_URL, $getUrl); // 抓取指定网页
curl_setopt($curl, CURLOPT_TIMEOUT, 1000); // 设置超时时间1秒
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // curl不直接输出到屏幕
curl_setopt($curl, CURLOPT_HEADER, 0); // 设置header
$data = curl_exec($curl); // 运行curl
if (!$data) {
print("an error occured in function request_get(): " . curl_error($curl) . "\n");
}
curl_close($curl);
return $data;
}
// 请求地址
$url = 'https://api.map.baidu.com/place/v2/detail';
// 构造请求参数
$param['uid'] = '435d7aea036e54355abbbcc8';
$param['output'] = 'json';
$param['scope'] = '2';
$param['ak'] = $ak;
$res = request_get($url, $param);
// 将原始返回的结果打印出来
print("请求的原始返回结果为:\n");
print($res . "\n");
?>
{
"status": 0,
"message": "ok",
"result": {
"uid": "435d7aea036e54355abbbcc8",
"street_id": "435d7aea036e54355abbbcc8",
"name": "百度大厦",
"location": {
"lng": 116.30773937593,
"lat": 40.056944251512
},
"address": "北京市海淀区上地十街10号",
"province": "北京市",
"city": "北京市",
"area": "海淀区",
"detail_info": {
"tag": "房地产;写字楼",
"navi_location": {
"lng": 116.30707498917,
"lat": 40.057189035977
},
"new_catalog": "100200",
"shop_hours": "",
"alias": [
""
],
"detail_url": "http://api.map.baidu.com/place/detail?uid=435d7aea036e54355abbbcc8&output=html&source=placeapi_v2",
"type": "house",
"overall_rating": "4.8",
"image_num": "102",
"comment_num": "166",
"content_tag": "位置优越;毗邻地铁;花园景观",
"mapsearch_son_display": {
"sontags": {
"2daf65a3a361f5faf8f0cb39": "(禁机动车)",
"25af43d34dc60565ac0457a8": "(仅限内部)"
},
"disable": "0",
"transfer": 1
}
},
"detail": 1
}
}
在线运行
参数备注必选
uid
poi的唯一标识,可用于详情检索
scope
检索结果详细程度。取值为1 或空,则返回基本信息;取值为2,返回检索POI详细信息
output
输出格式为json或者xml
地点输入提示
用户可通过该服务,匹配用户输入关键词的地点推荐列表。在应用方面,可将地点推荐列表展示给用户,用户可通过点击等交互方式,结合地点检索服务,检索用户点击的POI信息,实现地点详情检索功能。
示例代码

https://api.map.baidu.com/place/v2/suggestion?query=天安门&region=北京&city_limit=true&output=json&ak=你的ak
//GET请求

填写您的AK

输入AK可生成包含IP/SN校验方式的代码

<?php
// 此处填写你在控制台-应用管理-创建应用后获取的AK
$ak = '您的AK';
// 发起一个http get请求,并返回请求的结果
// $url字段为请求的地址
// $param字段为请求的参数
function request_get($url = '', $param = array()) {
if (empty($url) || empty($param)) {
return false;
}
$getUrl = $url . "?" . http_build_query($param);
$curl = curl_init(); // 初始化curl
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // 跳过证书检查
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); // 从证书中检查SSL加密算法是否存在
curl_setopt($curl, CURLOPT_URL, $getUrl); // 抓取指定网页
curl_setopt($curl, CURLOPT_TIMEOUT, 1000); // 设置超时时间1秒
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // curl不直接输出到屏幕
curl_setopt($curl, CURLOPT_HEADER, 0); // 设置header
$data = curl_exec($curl); // 运行curl
if (!$data) {
print("an error occured in function request_get(): " . curl_error($curl) . "\n");
}
curl_close($curl);
return $data;
}
// 请求地址
$url = 'https://api.map.baidu.com/place/v2/suggestion';
// 构造请求参数
$param['query'] = '天安门';
$param['region'] = '北京';
$param['city_limit'] = 'true';
$param['output'] = 'json';
$param['ak'] = $ak;
$res = request_get($url, $param);
// 将原始返回的结果打印出来
print("请求的原始返回结果为:\n");
print($res . "\n");
?>
{
"status":0,
"message":"ok",
"result":[
{
"name":"天安门广场",
"location":{
"lat":39.909652,
"lng":116.404177
},
"uid":"c9b5fb91d49345bc5d0d0262",
"province":"北京市",
"city":"北京市",
"district":"东城区",
"business":"",
"cityid":"131",
"tag":"旅游景点",
"address":"北京市-东城区-东长安街",
"children":[
{
"uid":"797c4f6023068d0ceedfcaf9",
"name":"天安门广场-出入口 北京市东城区",
"show_name":"出入口"
},
{
"uid":"ad764cbdedc637ec6d3e1b91",
"name":"天安门广场-出口 北京市东城区",
"show_name":"出口"
}
],
"adcode":"110101"
},
{
"name":"天安门",
"location":{
"lat":39.915119,
"lng":116.403963
},
"uid":"65e1ee886c885190f60e77ff",
"province":"北京市",
"city":"北京市",
"district":"东城区",
"business":"",
"cityid":"131",
"tag":"古建筑",
"address":"北京市-东城区-长安街",
"children":[
],
"adcode":"110101"
},
{
"name":"天安门东-地铁站",
"location":{
"lat":39.914082,
"lng":116.407913
},
"uid":"940aeb3c98d5a0218a2fb5de",
"province":"北京市",
"city":"北京市",
"district":"东城区",
"business":"",
"cityid":"131",
"tag":"地铁站",
"address":"",
"children":[
],
"adcode":"110101"
},
{
"name":"天安门广场-国旗",
"location":{
"lat":39.91328,
"lng":116.403931
},
"uid":"4ae2adcf574bcd2b38221c66",
"province":"北京市",
"city":"北京市",
"district":"东城区",
"business":"",
"cityid":"131",
"tag":"旅游景点",
"address":"北京市-东城区-天安门广场内",
"children":[
],
"adcode":"110101"
},
{
"name":"天安门西-地铁站",
"location":{
"lat":39.913776,
"lng":116.398036
},
"uid":"002975204d3b1e9b9968b4de",
"province":"北京市",
"city":"北京市",
"district":"西城区",
"business":"",
"cityid":"131",
"tag":"地铁站",
"address":"",
"children":[
],
"adcode":"110102"
},
{
"name":"天安门东地铁站-b口",
"uid":"448961a899f372b7077ce838",
"province":"",
"city":"",
"district":"",
"business":"",
"cityid":"131",
"tag":"",
"address":"北京市-东城区",
"children":[
]
},
{
"name":"天安门-入口",
"location":{
"lat":39.914939,
"lng":116.404137
},
"uid":"fd975efc10193656734b879a",
"province":"北京市",
"city":"北京市",
"district":"东城区",
"business":"",
"cityid":"131",
"tag":"出入口",
"address":"北京市-东城区-天安门内",
"children":[
],
"adcode":"110101"
},
{
"name":"天安门广场东-公交车站",
"location":{
"lat":39.908018,
"lng":116.405975
},
"uid":"bc3118720ad264138a36ee6f",
"province":"北京市",
"city":"北京市",
"district":"东城区",
"business":"",
"cityid":"131",
"tag":"公交站",
"address":"",
"children":[
],
"adcode":"110101"
},
{
"name":"天安门-城楼检票处(入口)",
"location":{
"lat":39.915739,
"lng":116.403663
},
"uid":"f7a0d122f3307a767dc876f1",
"province":"北京市",
"city":"北京市",
"district":"东城区",
"business":"",
"cityid":"131",
"tag":"出入口",
"address":"北京市-东城区-天安门内",
"children":[
],
"adcode":"110101"
},
{
"name":"天安门东-公交车站",
"location":{
"lat":39.914198,
"lng":116.408332
},
"uid":"947c13ba353f9123dbd891fb",
"province":"北京市",
"city":"北京市",
"district":"东城区",
"business":"",
"cityid":"131",
"tag":"公交站",
"address":"",
"children":[
],
"adcode":"110101"
}
]
}
在线运行
参数备注必选
query
输入建议关键字(支持拼音)
region
支持城市及对应百度编码(Citycode)。(指定的区域的返回结果加权,可能返回其他城市高权重结果。若要对返回结果区域严格限制,请使用city_limit参数)
city_limit
取值为'true',仅返回region中指定城市检索结果
output
输出格式为json或者xml
服务状态码
返回码英文描述定义常见原因
0ok正常服务请求正常召回
1服务器内部错误该服务响应超时或系统内部错误,请留下联系方式
2Parameter Invalid请求参数非法必要参数拼写错误或漏传(如query和tag请求中均未传入)
3Verify Failure权限校验失败
4Quota Failure配额校验失败服务当日调用次数已超限,请前往API控制台提升(请优先进行)开发者认证
5AK Failureak不存在或者非法未传入ak参数;ak已被删除(可前往回收站恢复);
8Parse Proto Failure数据解析失败一般是query输入有误导致,如query输入特殊字符,全角符号。
9Permission Denied高级权限校验失败
101AK参数不存在请求消息没有携带AK参数
200APP不存在,AK有误请检查再重试根据请求的ak,找不到对应的APP
201APP被用户自己禁用,请在控制台解禁
202APP被管理员删除恶意APP被管理员删除
203APP类型错误当前API控制台支持Server(类型1), Mobile(类型2, 新版控制台区分为Mobile_Android(类型21)及Mobile_IPhone(类型22))及Browser(类型3),除此之外其他类型认为是APP类型错误
210APP IP校验失败在申请SERVER类型应用的时候选择IP校验,需要填写IP白名单,如果当前请求的IP地址不在IP白名单或者不是0.0.0.0/0就认为IP校验失败
211APP SN校验失败SERVER类型APP有两种校验方式IP校验和SN校验,当用户请求的SN和服务端计算出来的SN不相等的时候提示SN校验失败
240APP 服务被禁用用户在API控制台中创建或设置某APP的时候禁用了某项服务,若需开通权限,可进入API控制台为AK勾选对应服务
250用户不存在根据请求的user_id, 数据库中找不到该用户的信息,请携带正确的user_id
251用户被自己删除该用户处于未激活状态
252用户被管理员删除恶意用户被加入黑名单
260服务不存在服务器解析不到用户请求的服务名称
261服务被禁用该服务已下线
302天配额超限,限制访问配额超限,如果想增加配额请联系我们
401当前并发量已经超过约定并发配额,限制访问并发控制超限,请控制并发量或联系我们

上一篇

使用准备

下一篇

行政区划区域检索

本篇文章对您是否有帮助?