Weibo/gettopic

出自天涯开放平台资源

跳转到: 导航, 搜索

目录

Weibo/gettopic

获取推荐话题列表

URL

http://open.tianya.cn/api/weibo/gettopic.php

支持格式

XML/JSON

HTTP请求方式

POST/GET

是否需要登录

true,关于授权机制,参见OAuth相关说明

请求数限制

true,关于请求数限制,参见OAuth相关说明

请求参数

  必选 类型及范围 说明
appkey true string 申请应用时分配的appkey,调用接口时候代表应用的唯一身份
oauth_token true string 授权成功后所获得的 oauth_token
oauth_token_secret true string 授权成功后所获得的oauth_token_secret
timestamp true string 请求时候产生的时间戳time()
tempkey true string strtoupper(md5($timestamp.$appkey.$oauth_token.$oauth_token_secret.$appsecret))
topic true int 话题名称
outformat false string 可选,返回数据格式,默认为json

注意事项

http://open.tianya.cn/api/weibo/getrecommends.php
若取当前用信息错误,则返回400错误,提示:"error_code"=>"40002", "error_msg"=>"request data error若取当前用信息错误,则返回400错误,提示: "error_code"=>"40002", "error_msg"=>"request data error"

返回结果

XML示例

<?xml version="1.0" encoding="utf8"?><data><bull>{"post":[{"topicTit":"绵阳公安交警回应","topicOrder":"0","topicDes":"%3Cp%3E%E5%85%AC%E5%AE%89%E6%9C%BA%E5%85%B3%E5%B0%86%E5%AF%B9%E6%AD%A4%E4%BA%8B%E4%BB%B6%E4%B8%AD%E7%9A%84%E5%9B%BE%E7%89%87%E6%9D%A5%E6%BA%90%E5%8F%8A%E7%9C%9F%E5%AE%9E%E6%80%A7%E8%BF%9B%E8%A1%8C%E8%B0%83%E6%9F%A5%EF%BC%8C%E8%B0%83%E6%9F%A5%E6%A0%B8%E5%AE%9E%E5%90%8E%E5%B0%86%E5%AF%B9%E5%85%B6%E8%B4%A3%E4%BB%BB%E5%8D%95%E4%BD%8D%E5%92%8C%E8%B4%A3%E4%BB%BB%E4%BA%BA%E4%BA%88%E4%B8%A5%E8%82%83%E5%A4%84%E7%90%86%EF%BC%8C%E7%BB%9D%E4%B8%8D%E5%A7%91%E6%81%AF%E8%BF%81%E5%B0%B1%EF%BC%8C%E5%B9%B6%E5%B0%86%E8%B0%83%E6%9F%A5%E7%BB%93%E6%9E%9C%E7%AC%AC%E4%B8%80%E6%97%B6%E9%97%B4%E5%85%AC%E5%B8%83%E3%80%82%E5%90%8C%E6%97%B6%EF%BC%8C%E5%B0%86%E5%AF%B9%E5%85%A8%E5%B8%82%E9%81%93%E8%B7%AF%E7%9B%91%E6%8E%A7%E7%B3%BB%E7%BB%9F%E8%BF%9B%E4%B8%80%E6%AD%A5%E7%AE%A1%E7%90%86%EF%BC%8C%E5%AF%B9%E5%A4%84%E4%BA%8E%E8%AF%95%E8%BF%90%E8%A1%8C%E9%98%B6%E6%AE%B5%E7%9A%84%E7%9B%91%E6%8E%A7%E8%AE%BE%E5%A4%87%E5%85%A8%E9%9D%A2%E8%B0%83%E8%AF%95%EF%BC%8C%E8%A7%84%E8%8C%83%E6%89%A7%E6%B3%95%E7%A8%8B%E5%BA%8F%EF%BC%8C%E7%A1%AE%E4%BF%9D%E5%85%AC%E4%BC%97%E7%9A%84%E4%B8%AA%E4%BA%BA%E4%BF%A1%E6%81%AF%E4%B8%8D%E5%8F%97%E4%BE%B5%E5%AE%B3%E3%80%82%3C%2Fp%3E"}],"people":[]}</bull><user>21068092</user><title>四川摸奶哥事件引发质疑</title><time>2011-08-22 21:46:57.0</time><pic>http://static1.tianyaui.com/w250/images/20110822/21068092/1314020313375.jpg</pic><focusnum>696</focusnum><name>摸奶哥</name><id>1515</id><des>“左手握着方向盘,让车辆以92KM/H的速度在路上行驶,右手却探向副驾位置上女生的胸部……”21日18点27分,一张电子眼抓拍的交通违法图在网上疯传,该事件在经历网友疯传、围观、调侃后,许多网友质疑公布该监控照片是否侵犯了公民隐私。</des></data><result>1</result><error></error>

JSON示例

 {"data":{"bull":"{\"post\":[{\"topicTit\":\"绵阳公安交警回应\",\"topicOrder\":\"0\",\"topicDes\":\"%3Cp%3E%E5%85%AC%E5%AE%89%E6%9C%BA%E5%85%B3%E5%B0%86%E5%AF%B9%E6%AD%A4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四川摸奶哥事件引发质疑","time":"2011-08-22 21:46:57.0","pic":"http://static1.tianyaui.com/w250/images/20110822/21068092/1314020313375.jpg","focusnum":696,"name":"摸奶哥","id":1515,"des":"“左手握着方向盘,让车辆以92KM/H的速度在路上行驶,右手却探向副驾位置上女生的胸部……”21日18点27分,一张电子眼抓拍的交通违法图在网上疯传,该事件在经历网友疯传、围观、调侃后,许多网友质疑公布该监控照片是否侵犯了公民隐私。"},"result":1,"error":""}

PHP示例

SDK下载

SDK下载
代码示例如下: 
include 'tyapi.php'; 
//参数设置 
SDK下载
代码示例如下: 
include 'tyapi.php'; 
//参数设置 
$appkey=; 
$appsecret=;
$url = 'http://open.tianya.cn/api/weibo/gettopic.php';
$param[‘topic’]=’摸奶哥’;
$param[‘outformat’]=xml;
$data = do_post($url,$appkey,$appsecret,$_SESSION["oauth_token"],$_SESSION["oauth_token_secret"],$param);
查看
个人工具
成功案例
帮助中心