Weibo/gettopicweibo

出自天涯开放平台资源

跳转到: 导航, 搜索

目录

Weibo/gettopicweibo

查看某话题的微博

URL

http://open.tianya.cn/api/weibo/gettopicweibo.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))
pagesize true int 每页显示条数
page true int 当前页码
topic true int 话题名称
outformat false string 可选,返回数据格式,默认为json

注意事项

http://open.tianya.cn/api/weibo/gettopicweibo.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><total>2873</total><items><item id="0"><sharedUname></sharedUname><sharedStartype>0</sharedStartype><time>1314657983000</time><id>37342874</id><star>0</star><originContent>#摸奶哥#好像被人肉出来了</originContent><sharedMedia></sharedMedia><sharedReplyCount>0</sharedReplyCount><shareCount>0</shareCount><url></url><sharedStarurl></sharedStarurl><body></body><sharedId>0</sharedId><startype>0</startype><medias></medias><sharedStar>0</sharedStar><word><a href="http://my.tianya.cn/#app=key_%E6%91%B8%E5%A5%B6%E5%93%A5">#摸奶哥#</a>好像被人肉出来了</word><sharedTitle></sharedTitle><uid>56519917</uid><media></media><from>来自天涯微博</from><uname>水飞月</uname><stardesc></stardesc><sharedUid>0</sharedUid><sharedShareCount>0</sharedShareCount><starurl></starurl><replyCount>0</replyCount><sharedMedias></sharedMedias><sharedStardesc></sharedStardesc></item><item id="1"><sharedUname></sharedUname><sharedStartype>0</sharedStartype><time>1314587916000</time><id>36780953</id><star>0</star><originContent>#摸奶哥#不超速,嘛事都没有,想干啥干啥!</originContent><sharedMedia></sharedMedia><sharedReplyCount>0</sharedReplyCount><shareCount>0</shareCount><url></url><sharedStarurl></sharedStarurl><body></body><sharedId>0</sharedId><startype>0</startype><medias></medias><sharedStar>0</sharedStar><word><a href="http://my.tianya.cn/#app=key_%E6%91%B8%E5%A5%B6%E5%93%A5">#摸奶哥#</a>不超速,嘛事都没有,想干啥干啥!</word><sharedTitle></sharedTitle><uid>56724391</uid><media></media><from>来自天涯微博</from><uname>杯杯2011</uname><stardesc></stardesc><sharedUid>0</sharedUid><sharedShareCount>0</sharedShareCount><starurl></starurl><replyCount>0</replyCount><sharedMedias></sharedMedias><sharedStardesc></sharedStardesc></item></items></data><result>1</result><error></error>

JSON示例

 {"data":{"total":2873,"items":[{"sharedUname":"","sharedStartype":0,"time":1314657983000,"id":37342874,"star":0,"originContent":"#摸奶哥#好像被人肉出来了","sharedMedia":"","sharedReplyCount":0,"shareCount":0,"url":"","sharedStarurl":"","body":"","sharedId":0,"startype":0,"medias":{},"sharedStar":0,"word":"<a href=\"http://my.tianya.cn/#app=key_%E6%91%B8%E5%A5%B6%E5%93%A5\">#摸奶哥#</a>好像被人肉出来了","sharedTitle":"","uid":56519917,"media":"","from":"来自天涯微博","uname":"水飞月","stardesc":"","sharedUid":0,"sharedShareCount":0,"starurl":"","replyCount":0,"sharedMedias":{},"sharedStardesc":""},{"sharedUname":"","sharedStartype":0,"time":1314587916000,"id":36780953,"star":0,"originContent":"#摸奶哥#不超速,嘛事都没有,想干啥干啥!","sharedMedia":"","sharedReplyCount":0,"shareCount":0,"url":"","sharedStarurl":"","body":"","sharedId":0,"startype":0,"medias":{},"sharedStar":0,"word":"<a href=\"http://my.tianya.cn/#app=key_%E6%91%B8%E5%A5%B6%E5%93%A5\">#摸奶哥#</a>不超速,嘛事都没有,想干啥干啥!","sharedTitle":"","uid":56724391,"media":"","from":"来自天涯微博","uname":"杯杯2011","stardesc":"","sharedUid":0,"sharedShareCount":0,"starurl":"","replyCount":0,"sharedMedias":{},"sharedStardesc":""}]},"result":1,"error":""}

PHP示例

SDK下载

SDK下载
代码示例如下: 
include 'tyapi.php'; 
//参数设置 
$appkey=; 
$appsecret=;
$url = 'http://open.tianya.cn/api/weibo/gettopicweibo.php';
$param[‘topic’]=’摸奶哥’;
$param[‘outformat’]=xml;
$param[‘page’]=1;
$param[‘pagesize’]=10;

$data = do_post($url,$appkey,$appsecret,$_SESSION["oauth_token"],$_SESSION["oauth_token_secret"],$param);
查看
个人工具
成功案例
帮助中心