Weibo/gethomeline

出自天涯开放平台资源

跳转到: 导航, 搜索

目录

weibo/gethomeline

获取我的微博主页关注者微博列表

URL

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

支持格式

XML/JSON

HTTP请求方式

POST/GET

是否需要登录

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

请求数限制

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

请求参数

  必选 类型及范围 说明
source 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))
page true int 当前页码
pagesize true int 每页大小
outformat false string ‘json’或’xml’,默认’json’

注意事项

http://open.tianya.cn/api/weibo/gethomeline.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>12</total><items><item id="0"><sharedUname></sharedUname><sharedBody></sharedBody><sharedStartype>0</sharedStartype><time>1315361028000</time><id>37464918</id><star>0</star><originContent>中文标题测试 http://tysurl.com/4syV9W</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://tysurl.com/4syV9W" title="http://www.tianya.cn/techforum/content/774/1098.shtml" target="_blank">http://tysurl.com/4syV9W</a></word><sharedTitle></sharedTitle><uid>51006851</uid><media></media><from>来自<a href="http://www.tianya.cn/bbs/" target="_blank">天涯论坛</a></from><uname>yiercn</uname><stardesc></stardesc><sharedUid>0</sharedUid><sharedShareCount>0</sharedShareCount><starurl></starurl><replyCount>0</replyCount><sharedMedias></sharedMedias><sharedStardesc></sharedStardesc></item><item id="1"><sharedUname></sharedUname><sharedBody></sharedBody><sharedStartype>0</sharedStartype><time>1315360726000</time><id>37464631</id><star>0</star><originContent>bbs title test http://tysurl.com/XsyOOP</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>bbs title test <a href="http://tysurl.com/XsyOOP" title="http://www.tianya.cn/techforum/content/774/1097.shtml" target="_blank">http://tysurl.com/XsyOOP</a></word><sharedTitle></sharedTitle><uid>51006851</uid><media></media><from>来自<a href="http://www.tianya.cn/bbs/" target="_blank">天涯论坛</a></from><uname>yiercn</uname><stardesc></stardesc><sharedUid>0</sharedUid><sharedShareCount>0</sharedShareCount><starurl></starurl><replyCount>0</replyCount><sharedMedias></sharedMedias><sharedStardesc></sharedStardesc></item></items><time>1315892296285</time></data><result>1</result><error></error>

JSON示例

 {"data":{"sharedUname":"","sharedStartype":0,"time":1314174793000,"id":36888156,"star":0,"originContent":"测试,erer,dff","sharedMedia":"","sharedReplyCount":0,"shareCount":1,"url":"","sharedStarurl":"","body":"","sharedId":0,"startype":0,"medias":{"image":[{"sUrl":"http://img3.laibafile.cn/getimgLMS/small/76894725.jpg","lUrl":"http://img3.laibafile.cn/getimgLMS/large/76894725.jpg","mUrl":"http://img3.laibafile.cn/getimgLMS/middle/76894725.jpg"}]},"sharedStar":0,"word":"测试,erer,dff","sharedTitle":"","uid":51218315,"media":"image|image/*|http://img3.laibafile.cn/getimgLMS/small/76894725.jpg;http://img3.laibafile.cn/getimgLMS/middle/76894725.jpg;http://img3.laibafile.cn/getimgLMS/large/76894725.jpg,","from":"来自天涯开放平台","uname":"opentest","stardesc":"","sharedUid":0,"sharedShareCount":0,"starurl":"","replyCount":102,"sharedMedias":{},"sharedStardesc":""},"result":1,"error":""}

字段说明

   {   
   "result":"1",   
   "error":"",   
   "data":{   
       "time":123123123,   
       "total":"1232",   
        "items":[   
           {   
              "appId":"share",   
              "body":"新鲜事body的内容",   
              "word":"新鲜事标题,微博的标题也在这里",   
               "originContent": "",//解析前的word   
               "uid":"669448",   
               "uname":"用户名",   
               "userheadphoto":用户头像,
               "star":"1",//1为牛人,0或没有为非牛人   
               "startype":1,//1为企业认证,2为微博v用户,3为手机绑定用户   
               "stardesc":,//相关类别下的star描述。(手机用户为空)   
               "starurl":"",//企业认证用户的url   
             "url":,//论坛,博客,帖子的url,微博的url也在这里   
                  
          /* 下面的和获取微博接口一样 */  
               "id":"111",   
               "time":"1280205001811",   
               "from":"通过网页", //途径 来自论坛,博客,相册,通过网页,短信   
          "shareCount":"12",   
               "replyCount":"23",   
               "media":"", //引用的图片   
          "medias" : "",//参数说明请参考页首描述   
           "mediaFlag":"",//原创的的多媒体类型   
                   
           /*如果该微博是转发*/  
               "sharedId":"",   
               "sharedUid":"",   
               "sharedStar":"1",//1为牛人,0或没有为非牛人   
          "sharedStartype":1,//1为企业认证,2为微博v用户,3为手机绑定用户   
          "sharedStardesc":,//相关类别下的star描述。(手机用户为空)   
          "sharedStarurl":"",//企业认证用户的url   
               "sharedUname":"",   
               "sharedTitle":"",   
               "sharedMedia":"",   
               "sharedMedias":,//参数说明请参考页首描述   
          "sharedMediaFlag":"",//被转发的多媒体类型   
          "sharedShareCount":"",   
                "sharedReplyCount":""  
          }   
          /* ... */  
       ]   
    }   
}   


PHP示例

SDK下载

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