Pois/get poi
Zhangchao2 (讨论 | 贡献) (→请求参数) |
|||
(未显示1个用户的10个中间版本) | |||
第3行: | 第3行: | ||
== '''URL''' == | == '''URL''' == | ||
− | http://api. | + | http://api.t.sina.com.cn/location/pois/get_poi.(json|xml) |
== '''支持格式''' == | == '''支持格式''' == | ||
第12行: | 第12行: | ||
== '''是否需要登录''' == | == '''是否需要登录''' == | ||
− | ''' | + | '''true''' |
== '''请求参数''' == | == '''请求参数''' == | ||
第20行: | 第20行: | ||
! style="text-align:center;width:20%" |类型及范围 | ! style="text-align:center;width:20%" |类型及范围 | ||
! style="text-align:center;width:50%" |说明 | ! style="text-align:center;width:50%" |说明 | ||
− | |- style="height:px | + | |- style="height:px" |
| style="text-align:center;" |source | | style="text-align:center;" |source | ||
| style="text-align:center;" |true | | style="text-align:center;" |true | ||
第29行: | 第29行: | ||
| style="text-align:center;" |true | | style="text-align:center;" |true | ||
| style="text-align:center;" |string | | style="text-align:center;" |string | ||
− | | | + | | 需查询来源ID(多个ID之间用“,”分割;多个ID中只要出现之前未上传的ID则无结果返回) |
− | + | ||
|} | |} | ||
第37行: | 第36行: | ||
=== '''XML示例''' === | === '''XML示例''' === | ||
<pre> | <pre> | ||
− | < | + | <?xml version="1.0" encoding="UTF-8" ?> |
− | + | <geoResult> | |
− | + | <num>2</num> | |
<pois> | <pois> | ||
<poi> | <poi> | ||
第61行: | 第60行: | ||
... | ... | ||
</pois> | </pois> | ||
− | </ | + | </geoResult> |
</pre> | </pre> | ||
第67行: | 第66行: | ||
<pre> | <pre> | ||
{ | { | ||
− | |||
"num":2, | "num":2, | ||
"pois": | "pois": | ||
第92行: | 第90行: | ||
] | ] | ||
} | } | ||
+ | |||
</pre> | </pre> | ||
=== '''字段说明 ''' === | === '''字段说明 ''' === | ||
− | |||
:num:结果总数 | :num:结果总数 | ||
:pois:结果集 | :pois:结果集 | ||
第111行: | 第109行: | ||
::description: POI点介绍 | ::description: POI点介绍 | ||
::traffic: POI点交通换乘描述 | ::traffic: POI点交通换乘描述 | ||
− | + | ::deal:POI的处理状态(0:未处理;1:已处理但未生成SPID;2:已处理且生成SPID;3:已发布) | |
− | ::deal:POI的处理状态 | + | |
::spid:POI点的SPID | ::spid:POI点的SPID | ||
− | == ''' | + | == '''其它''' == |
+ | === '''PHP示例''' === | ||
+ | 需要开启PHP的cURL扩展 | ||
<pre> | <pre> | ||
− | + | <?php | |
− | + | //改为你的微博账号,用户名和密码之间用:隔开 | |
+ | $userPwd = 'user@sina.com:pwd'; | ||
+ | //改为你微博应用的appkey | ||
+ | $appkey = '0123456789'; | ||
− | + | $url = "http://api.t.sina.com.cn/location/pois/get_poi.xml?srcids=test001&source=$appkey"; | |
− | http://api. | + | |
+ | $rst = curlSample($url,$userPwd); | ||
+ | |||
+ | echo $rst; | ||
+ | |||
+ | function curlSample($url,$userPwd,$postFields = '',$header = ''){ | ||
+ | $ch = curl_init() or die (curl_error()) ; | ||
+ | curl_setopt($ch,CURLOPT_URL,$url); | ||
+ | curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); | ||
+ | curl_setopt($ch,CURLOPT_TIMEOUT,30); | ||
+ | if(!empty($userPwd)){ | ||
+ | curl_setopt($ch,CURLOPT_USERPWD,$userPwd); | ||
+ | } | ||
+ | if(!empty($postFields)){ | ||
+ | curl_setopt($ch,CURLOPT_POST,true); | ||
+ | curl_setopt($ch,CURLOPT_POSTFIELDS,$postFields); | ||
+ | } | ||
+ | if(!empty($header)){ | ||
+ | curl_setopt($ch, CURLOPT_HTTPHEADER,$header); | ||
+ | } | ||
+ | $result = curl_exec($ch) or die (curl_error($ch)); | ||
+ | curl_close($ch); | ||
+ | return $result; | ||
+ | } | ||
+ | ?> | ||
</pre> | </pre> |
2011年8月11日 (四) 14:29的最后版本
目录 |
pois/get_poi
获取之前提交的POI信息。
URL
http://api.t.sina.com.cn/location/pois/get_poi.(json%7Cxml)
支持格式
JSON|XML
HTTP请求方式
GET
是否需要登录
true
请求参数
参数 | 必选 | 类型及范围 | 说明 |
---|---|---|---|
source | true | string | 申请应用时分配的AppKey |
srcids | true | string | 需查询来源ID(多个ID之间用“,”分割;多个ID中只要出现之前未上传的ID则无结果返回) |
返回结果
XML示例
<?xml version="1.0" encoding="UTF-8" ?> <geoResult> <num>2</num> <pois> <poi> <srcid>20</srcid> <name>理想国际大厦</name> <address>北四环西路58号</address> <telephone/> <city>北京</city> <category>大厦</category> <longitude>116.30995</longitude> <latitude>39.98465</latitude> <intro/> <url/> <tags/> <description/> <traffic/> <pic_url/> <deal>0</deal> <spid/> </poi> ... </pois> </geoResult>
JSON示例
{ "num":2, "pois": [ { "srcid":"20", "name":"\u7406\u60f3\u56fd\u9645\u5927\u53a6", "address":"\u5317\u56db\u73af\u897f\u8def58\u53f7", "telephone":"", "city":"\u5317\u4eac", "category":"\u5927\u53a6", "longitude":"116.30995", "latitude":"39.98465", "intro":"", "url":"", "tags":"", "description":"", "traffic":"", "pic_url":"", "deal":"0", "spid":"" }, ... ] }
字段说明
- num:结果总数
- pois:结果集
- srcid: POI来源id
- name: POI点名称
- address: POI点地址
- telephone: POI点联系电话
- city: POI点城市
- category: POI点类别
- longitude: POI点经度
- latitude: POI点纬度
- intro:POI点其他特色信息
- url: POI点网址链接
- tags: POI点标签
- description: POI点介绍
- traffic: POI点交通换乘描述
- deal:POI的处理状态(0:未处理;1:已处理但未生成SPID;2:已处理且生成SPID;3:已发布)
- spid:POI点的SPID
其它
PHP示例
需要开启PHP的cURL扩展
<?php //改为你的微博账号,用户名和密码之间用:隔开 $userPwd = 'user@sina.com:pwd'; //改为你微博应用的appkey $appkey = '0123456789'; $url = "http://api.t.sina.com.cn/location/pois/get_poi.xml?srcids=test001&source=$appkey"; $rst = curlSample($url,$userPwd); echo $rst; function curlSample($url,$userPwd,$postFields = '',$header = ''){ $ch = curl_init() or die (curl_error()) ; curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_TIMEOUT,30); if(!empty($userPwd)){ curl_setopt($ch,CURLOPT_USERPWD,$userPwd); } if(!empty($postFields)){ curl_setopt($ch,CURLOPT_POST,true); curl_setopt($ch,CURLOPT_POSTFIELDS,$postFields); } if(!empty($header)){ curl_setopt($ch, CURLOPT_HTTPHEADER,$header); } $result = curl_exec($ch) or die (curl_error($ch)); curl_close($ch); return $result; } ?>
文档更新时间: 2011-08-11