Statuses/user timeline

跳转到: 导航, 搜索
(返回结果)
第30行: 第30行:
  
 
===返回结果===
 
===返回结果===
XML示例:
+
====XML====
 
<pre>
 
<pre>
<?xml version="1.0" encoding="UTF-8"?>
+
<?xml version="1.0" encoding="UTF-8"?>
<statuses>
+
<statuses>
 
   <status>
 
   <status>
     <created_at>Tue Dec 01 08:51:58 +0800 2009</created_at>
+
     <created_at>Mon Sep 13 14:25:38 +0800 2010</created_at>
     <id>99999999</id>
+
     <id>2585938903</id>
     <text>只见AC米兰的巴蒂斯图塔突破马尔蒂尼,一脚凌空抽射,被裁判扑了出来。</text>
+
     <text>今日又和@陈奕利 导演一起吃饭,他说:上次我们吃饭被偷拍的那个绯闻让我很生气。我:是啊,我也很生气。陈导:不是的,我有个朋友说,这消息一看就是假的,姚晨怎么可能看上你呢?我有那么差吗?我太生气了!我:呃,导演,你节哀顺便...</text>
 
     <source>
 
     <source>
       <a href="http://t.sina.com.cn">Web</a>
+
       <a href="http://news.sina.com.cn/wap/wbclient.html#3">iPhone客户端</a>
 
     </source>
 
     </source>
 
     <favorited>false</favorited>
 
     <favorited>false</favorited>
 
     <truncated>false</truncated>
 
     <truncated>false</truncated>
     <in_reply_to_status_id></in_reply_to_status_id>
+
     <geo/>
     <in_reply_to_user_id></in_reply_to_user_id>
+
    <in_reply_to_status_id/>
     <in_reply_to_screen_name></in_reply_to_screen_name>
+
     <in_reply_to_user_id/>
     <thumbnail_pic>http://static16.photo.sina.com.cn/thumbnail/62988d06tcbbc377f7bbf</thumbnail_pic>
+
     <in_reply_to_screen_name/>
     <bmiddle_pic>http://static16.photo.sina.com.cn/bmiddle/62988d06tcbbc377f7bbf</bmiddle_pic>
+
     <thumbnail_pic>http://ss4.sinaimg.cn/thumbnail/4b7a89894901e2a285b43&amp;690</thumbnail_pic>
     <original_pic>http://static16.photo.sina.com.cn/orignal/62988d06tcbbc377f7bbf</original_pic>
+
     <bmiddle_pic>http://ss4.sinaimg.cn/bmiddle/4b7a89894901e2a285b43&amp;690</bmiddle_pic>
 +
     <original_pic>http://ss4.sinaimg.cn/orignal/4b7a89894901e2a285b43&amp;690</original_pic>
 
     <user>
 
     <user>
       <id>1141457724</id>
+
       <id>1266321801</id>
       <screen_name>1141457724</screen_name>
+
       <screen_name>姚晨</screen_name>
       <name>1141457724</name>
+
       <name>姚晨</name>
       <location>广州</location>
+
      <province>11</province>
       <description>blog: timyang.net</description>
+
      <city>5</city>
       <url>http://timyang.net</url>
+
       <location>北京 朝阳区</location>
       <profile_image_url>http://portrait.sinaimg.cn/1141457724/50#.jpg</profile_image_url>
+
       <description>一颗很逊的卤蛋。</description>
       <followers_count>0</followers_count>
+
       <url>http://blog.sina.com.cn/yaochen</url>
       <friends_count>0</friends_count>
+
       <profile_image_url>http://tp2.sinaimg.cn/1266321801/50/1283203855</profile_image_url>
       <statuses_count>0</statuses_count>
+
      <domain>yaochen</domain>
       <favourites_count>0</favourites_count>
+
      <gender>f</gender>
 +
       <followers_count>2823102</followers_count>
 +
       <friends_count>562</friends_count>
 +
       <statuses_count>2159</statuses_count>
 +
       <favourites_count>10</favourites_count>
 +
      <created_at>Fri Aug 28 00:00:00 +0800 2009</created_at>
 
       <following>false</following>
 
       <following>false</following>
 
       <verified>true</verified>
 
       <verified>true</verified>
 +
      <allow_all_act_msg>false</allow_all_act_msg>
 +
      <geo_enabled>false</geo_enabled>
 
     </user>
 
     </user>
    <retweeted_status>
 
      <created_at>Tue Dec 01 08:51:58 +0800 2009</created_at>
 
      <id>100000000</id>
 
      <text>虽然渴者只要少许的水便够了,我却很快活地给与了我全部的水。</text>
 
      <source>
 
        <a href="http://t.sina.com.cn">Web</a>
 
      </source>
 
      <favorited>false</favorited>
 
      <truncated>false</truncated>
 
      <in_reply_to_status_id></in_reply_to_status_id>
 
      <in_reply_to_user_id></in_reply_to_user_id>
 
      <in_reply_to_screen_name></in_reply_to_screen_name>
 
      <user>
 
        <id>1337040644</id>
 
        <screen_name>1337040644</screen_name>
 
        <name>1337040644</name>
 
        <location>广州</location>
 
        <description>blog: timyang.net</description>
 
        <profile_image_url>http://portrait.sinaimg.cn/1337040644/50#.jpg</profile_image_url>
 
        <followers_count>0</followers_count>
 
        <friends_count>0</friends_count>
 
        <statuses_count>0</statuses_count>
 
        <favourites_count>0</favourites_count>
 
        <following>false</following>
 
        <verified>false</verified>
 
      </user>
 
    </retweeted_status>
 
 
   </status>
 
   </status>
    ... truncated ...
+
  <status>
</statuses>
+
    <created_at>Mon Sep 13 13:43:37 +0800 2010</created_at>
 +
    <id>2584937192</id>
 +
    <text>今日提前欣赏了一下<爱出色>的大银幕效果,这是画面定格一瞬间拍到的,看看,二老的侧面都长得很艺术啊:)</text>
 +
    <source>
 +
      <a href="http://news.sina.com.cn/wap/wbclient.html#3">iPhone客户端</a>
 +
    </source>
 +
    <favorited>false</favorited>
 +
    <truncated>false</truncated>
 +
    <geo/>
 +
    <in_reply_to_status_id/>
 +
    <in_reply_to_user_id/>
 +
    <in_reply_to_screen_name/>
 +
    <thumbnail_pic>http://ss2.sinaimg.cn/thumbnail/4b7a89894901d93f8ad21&amp;690</thumbnail_pic>
 +
    <bmiddle_pic>http://ss2.sinaimg.cn/bmiddle/4b7a89894901d93f8ad21&amp;690</bmiddle_pic>
 +
    <original_pic>http://ss2.sinaimg.cn/orignal/4b7a89894901d93f8ad21&amp;690</original_pic>
 +
    <user>
 +
      <id>1266321801</id>
 +
      <screen_name>姚晨</screen_name>
 +
      <name>姚晨</name>
 +
      <province>11</province>
 +
      <city>5</city>
 +
      <location>北京 朝阳区</location>
 +
      <description>一颗很逊的卤蛋。</description>
 +
      <url>http://blog.sina.com.cn/yaochen</url>
 +
      <profile_image_url>http://tp2.sinaimg.cn/1266321801/50/1283203855</profile_image_url>
 +
      <domain>yaochen</domain>
 +
      <gender>f</gender>
 +
      <followers_count>2822671</followers_count>
 +
      <friends_count>562</friends_count>
 +
      <statuses_count>2158</statuses_count>
 +
      <favourites_count>10</favourites_count>
 +
      <created_at>Fri Aug 28 00:00:00 +0800 2009</created_at>
 +
      <following>false</following>
 +
      <verified>true</verified>
 +
      <allow_all_act_msg>false</allow_all_act_msg>
 +
      <geo_enabled>false</geo_enabled>
 +
    </user>
 +
  </status>
 +
</statuses>
 
</pre>
 
</pre>
 
JSON示例:
 
JSON示例:
 
<pre>
 
<pre>
[
+
[
  {"created_at":"Mon Dec 28 19:20:18 +0800 2009",
+
  {
  "id":141654,
+
      "created_at":"Mon Sep 13 14:25:38 +0800 2010",
  "text":"aaaasdf",
+
      "id":2585938903,
  "source":"<a id=\"0\" href=\"http://t.sina.com.cn/\" rel=\"nofollow\">Web</a>",
+
      "text":"今日又和@陈奕利 导演一起吃饭,他说:上次我们吃饭被偷拍的那个绯闻让我很生气。我:是啊,我也很生气。陈导:不是的,我有个朋友说,这消息一看就是假的,姚晨怎么可能看上你呢?我有那么差吗?我太生气了!我:呃,导演,你节哀顺便...",
  "favorited":false,
+
      "source":"<a href=\"http://news.sina.com.cn/wap/wbclient.html#3\" rel=\"nofollow\">iPhone客户端</a>",
  "truncated":false,
+
      "favorited":false,
  "in_reply_to_status_id":"",
+
      "truncated":false,
  "in_reply_to_user_id":"",
+
      "in_reply_to_status_id":"",
  "in_reply_to_screen_name":"",
+
      "in_reply_to_user_id":"",
  "geo":null,
+
      "in_reply_to_screen_name":"",
  "user":{"id":11075,
+
      "thumbnail_pic":"http://ss4.sinaimg.cn/thumbnail/4b7a89894901e2a285b43&690",
         "screen_name":"name_11075",
+
      "bmiddle_pic":"http://ss4.sinaimg.cn/bmiddle/4b7a89894901e2a285b43&690",
         "name":"name_11075",
+
      "original_pic":"http://ss4.sinaimg.cn/orignal/4b7a89894901e2a285b43&690",
         "province":0,
+
      "geo":null,
         "city":0,
+
      "user":{
         "location":"",
+
        "id":1266321801,
         "description":"",
+
        "screen_name":"姚晨",
         "url":"",
+
        "name":"姚晨",
         "profile_image_url":"http://tp4.sinaimg.cn/11075/50/0",
+
        "province":"11",
         "domain":"11075",
+
        "city":"5",
         "followers_count":28,
+
        "location":"北京 朝阳区",
         "friends_count":50,
+
        "description":"一颗很逊的卤蛋。",
         "statuses_count":0,
+
        "url":"http://blog.sina.com.cn/yaochen",
         "favourites_count":0,
+
        "profile_image_url":"http://tp2.sinaimg.cn/1266321801/50/1283203855",
         "created_at":"Thu Jan 01 08:00:00 +0800 1970",
+
        "domain":"yaochen",
 +
        "gender":"f",
 +
        "followers_count":2823102,
 +
        "friends_count":562,
 +
        "statuses_count":2159,
 +
        "favourites_count":10,
 +
        "created_at":"Fri Aug 28 00:00:00 +0800 2009",
 +
        "following":false,
 +
        "allow_all_act_msg":false,
 +
        "geo_enabled":false,
 +
        "verified":true
 +
      }
 +
  },
 +
  {
 +
      "created_at":"Mon Sep 13 13:43:37 +0800 2010",
 +
      "id":2584937192,
 +
      "text":"今日提前欣赏了一下<爱出色>的大银幕效果,这是画面定格一瞬间拍到的,看看,二老的侧面都长得很艺术啊:)",
 +
      "source":"<a href=\"http://news.sina.com.cn/wap/wbclient.html#3\" rel=\"nofollow\">iPhone客户端</a>",
 +
      "favorited":false,
 +
      "truncated":false,
 +
      "in_reply_to_status_id":"",
 +
      "in_reply_to_user_id":"",
 +
      "in_reply_to_screen_name":"",
 +
      "thumbnail_pic":"http://ss2.sinaimg.cn/thumbnail/4b7a89894901d93f8ad21&690",
 +
      "bmiddle_pic":"http://ss2.sinaimg.cn/bmiddle/4b7a89894901d93f8ad21&690",
 +
      "original_pic":"http://ss2.sinaimg.cn/orignal/4b7a89894901d93f8ad21&690",
 +
      "geo":null,
 +
      "user":{
 +
        "id":1266321801,
 +
         "screen_name":"姚晨",
 +
         "name":"姚晨",
 +
         "province":"11",
 +
         "city":"5",
 +
         "location":"北京 朝阳区",
 +
         "description":"一颗很逊的卤蛋。",
 +
         "url":"http://blog.sina.com.cn/yaochen",
 +
         "profile_image_url":"http://tp2.sinaimg.cn/1266321801/50/1283203855",
 +
         "domain":"yaochen",
 +
        "gender":"f",
 +
         "followers_count":2822671,
 +
         "friends_count":562,
 +
         "statuses_count":2158,
 +
         "favourites_count":10,
 +
         "created_at":"Fri Aug 28 00:00:00 +0800 2009",
 
         "following":false,
 
         "following":false,
 +
        "allow_all_act_msg":false,
 
         "geo_enabled":false,
 
         "geo_enabled":false,
         "verified":true}
+
         "verified":true
  },
+
      }
  {},...
+
  }
]
+
]
 
</pre>
 
</pre>
 
{{Param_status}}
 
{{Param_status}}

2010年9月13日 (一) 17:02的版本

目录

statuses/user_timeline

返回用户的发布的最近n条信息,和用户微博页面返回内容是一致的。此接口也可以请求其他用户的最新发表微博。

URL

http://api.t.sina.com.cn/statuses/user_timeline.format

格式

xml,json

HTTP请求方式

GET

是否需要登录

true

请求数限制

true

关于请求数限制,参见接口访问权限说明

请求参数

  • id: 可选参数. 根据指定用户UID或微博昵称来返回微博信息。
o 示例: http://api.t.sina.com.cn/statuses/user_timeline/12345.xml
  • user_id: 可选参数. 用户UID,主要是用来区分用户UID跟微博昵称一样,产生歧义的时候,特别是在微博昵称为数字导致和用户Uid发生歧义。
o 示例: http://api.t.sina.com.cn/statuses/user_timeline.xml?user_id=1401881
  • screen_name:可选参数.微博昵称,主要是用来区分用户UID跟微博昵称一样,产生歧义的时候。
o 示例: http://api.t.sina.com.cn/statuses/user_timeline.xml?screen_name=101010
  • since_id:可选参数(微博信息ID). 只返回ID比since_id大(比since_id时间晚的)的微博信息内容
o 示例: http://api.t.sina.com.cn/statuses/user_timeline.xml?since_id=12345
  • max_id: 可选参数(微博信息ID). 返回ID不大于max_id的微博信息内容。
o 示例: Example: http://api.t.sina.com.cn/statuses/user_timeline.xml?max_id=54321
  • count: 可选参数. 每次返回的最大记录数,最多返回200条,默认20。
o 示例: http://api.t.sina.com.cn/statuses/user_timeline.xml?count=200
  • page: 可选参数. 分页返回。注意:最多返回200条分页内容。
o Example: http://api.t.sina.com.cn/statuses/user_timeline.xml?page=3

使用说明

  • 默认返回最近15天以内的微博信息
  • 由于分页限制,暂时最多只能返回用户最新的200条微博信息
  • 用户最多只能请求到最近200条记录

返回结果

XML

<?xml version="1.0" encoding="UTF-8"?>
<statuses>
  <status>
    <created_at>Mon Sep 13 14:25:38 +0800 2010</created_at>
    <id>2585938903</id>
    <text>今日又和@陈奕利 导演一起吃饭,他说:上次我们吃饭被偷拍的那个绯闻让我很生气。我:是啊,我也很生气。陈导:不是的,我有个朋友说,这消息一看就是假的,姚晨怎么可能看上你呢?我有那么差吗?我太生气了!我:呃,导演,你节哀顺便...</text>
    <source>
      <a href="http://news.sina.com.cn/wap/wbclient.html#3">iPhone客户端</a>
    </source>
    <favorited>false</favorited>
    <truncated>false</truncated>
    <geo/>
    <in_reply_to_status_id/>
    <in_reply_to_user_id/>
    <in_reply_to_screen_name/>
    <thumbnail_pic>http://ss4.sinaimg.cn/thumbnail/4b7a89894901e2a285b43&690</thumbnail_pic>
    <bmiddle_pic>http://ss4.sinaimg.cn/bmiddle/4b7a89894901e2a285b43&690</bmiddle_pic>
    <original_pic>http://ss4.sinaimg.cn/orignal/4b7a89894901e2a285b43&690</original_pic>
    <user>
      <id>1266321801</id>
      <screen_name>姚晨</screen_name>
      <name>姚晨</name>
      <province>11</province>
      <city>5</city>
      <location>北京 朝阳区</location>
      <description>一颗很逊的卤蛋。</description>
      <url>http://blog.sina.com.cn/yaochen</url>
      <profile_image_url>http://tp2.sinaimg.cn/1266321801/50/1283203855</profile_image_url>
      <domain>yaochen</domain>
      <gender>f</gender>
      <followers_count>2823102</followers_count>
      <friends_count>562</friends_count>
      <statuses_count>2159</statuses_count>
      <favourites_count>10</favourites_count>
      <created_at>Fri Aug 28 00:00:00 +0800 2009</created_at>
      <following>false</following>
      <verified>true</verified>
      <allow_all_act_msg>false</allow_all_act_msg>
      <geo_enabled>false</geo_enabled>
    </user>
  </status>
  <status>
    <created_at>Mon Sep 13 13:43:37 +0800 2010</created_at>
    <id>2584937192</id>
    <text>今日提前欣赏了一下<爱出色>的大银幕效果,这是画面定格一瞬间拍到的,看看,二老的侧面都长得很艺术啊:)</text>
    <source>
      <a href="http://news.sina.com.cn/wap/wbclient.html#3">iPhone客户端</a>
    </source>
    <favorited>false</favorited>
    <truncated>false</truncated>
    <geo/>
    <in_reply_to_status_id/>
    <in_reply_to_user_id/>
    <in_reply_to_screen_name/>
    <thumbnail_pic>http://ss2.sinaimg.cn/thumbnail/4b7a89894901d93f8ad21&690</thumbnail_pic>
    <bmiddle_pic>http://ss2.sinaimg.cn/bmiddle/4b7a89894901d93f8ad21&690</bmiddle_pic>
    <original_pic>http://ss2.sinaimg.cn/orignal/4b7a89894901d93f8ad21&690</original_pic>
    <user>
      <id>1266321801</id>
      <screen_name>姚晨</screen_name>
      <name>姚晨</name>
      <province>11</province>
      <city>5</city>
      <location>北京 朝阳区</location>
      <description>一颗很逊的卤蛋。</description>
      <url>http://blog.sina.com.cn/yaochen</url>
      <profile_image_url>http://tp2.sinaimg.cn/1266321801/50/1283203855</profile_image_url>
      <domain>yaochen</domain>
      <gender>f</gender>
      <followers_count>2822671</followers_count>
      <friends_count>562</friends_count>
      <statuses_count>2158</statuses_count>
      <favourites_count>10</favourites_count>
      <created_at>Fri Aug 28 00:00:00 +0800 2009</created_at>
      <following>false</following>
      <verified>true</verified>
      <allow_all_act_msg>false</allow_all_act_msg>
      <geo_enabled>false</geo_enabled>
    </user>
  </status>
</statuses>

JSON示例:

[
   {
      "created_at":"Mon Sep 13 14:25:38 +0800 2010",
      "id":2585938903,
      "text":"今日又和@陈奕利 导演一起吃饭,他说:上次我们吃饭被偷拍的那个绯闻让我很生气。我:是啊,我也很生气。陈导:不是的,我有个朋友说,这消息一看就是假的,姚晨怎么可能看上你呢?我有那么差吗?我太生气了!我:呃,导演,你节哀顺便...",
      "source":"<a href=\"http://news.sina.com.cn/wap/wbclient.html#3\" rel=\"nofollow\">iPhone客户端</a>",
      "favorited":false,
      "truncated":false,
      "in_reply_to_status_id":"",
      "in_reply_to_user_id":"",
      "in_reply_to_screen_name":"",
      "thumbnail_pic":"http://ss4.sinaimg.cn/thumbnail/4b7a89894901e2a285b43&690",
      "bmiddle_pic":"http://ss4.sinaimg.cn/bmiddle/4b7a89894901e2a285b43&690",
      "original_pic":"http://ss4.sinaimg.cn/orignal/4b7a89894901e2a285b43&690",
      "geo":null,
      "user":{
         "id":1266321801,
         "screen_name":"姚晨",
         "name":"姚晨",
         "province":"11",
         "city":"5",
         "location":"北京 朝阳区",
         "description":"一颗很逊的卤蛋。",
         "url":"http://blog.sina.com.cn/yaochen",
         "profile_image_url":"http://tp2.sinaimg.cn/1266321801/50/1283203855",
         "domain":"yaochen",
         "gender":"f",
         "followers_count":2823102,
         "friends_count":562,
         "statuses_count":2159,
         "favourites_count":10,
         "created_at":"Fri Aug 28 00:00:00 +0800 2009",
         "following":false,
         "allow_all_act_msg":false,
         "geo_enabled":false,
         "verified":true
      }
   },
   {
      "created_at":"Mon Sep 13 13:43:37 +0800 2010",
      "id":2584937192,
      "text":"今日提前欣赏了一下<爱出色>的大银幕效果,这是画面定格一瞬间拍到的,看看,二老的侧面都长得很艺术啊:)",
      "source":"<a href=\"http://news.sina.com.cn/wap/wbclient.html#3\" rel=\"nofollow\">iPhone客户端</a>",
      "favorited":false,
      "truncated":false,
      "in_reply_to_status_id":"",
      "in_reply_to_user_id":"",
      "in_reply_to_screen_name":"",
      "thumbnail_pic":"http://ss2.sinaimg.cn/thumbnail/4b7a89894901d93f8ad21&690",
      "bmiddle_pic":"http://ss2.sinaimg.cn/bmiddle/4b7a89894901d93f8ad21&690",
      "original_pic":"http://ss2.sinaimg.cn/orignal/4b7a89894901d93f8ad21&690",
      "geo":null,
      "user":{
         "id":1266321801,
         "screen_name":"姚晨",
         "name":"姚晨",
         "province":"11",
         "city":"5",
         "location":"北京 朝阳区",
         "description":"一颗很逊的卤蛋。",
         "url":"http://blog.sina.com.cn/yaochen",
         "profile_image_url":"http://tp2.sinaimg.cn/1266321801/50/1283203855",
         "domain":"yaochen",
         "gender":"f",
         "followers_count":2822671,
         "friends_count":562,
         "statuses_count":2158,
         "favourites_count":10,
         "created_at":"Fri Aug 28 00:00:00 +0800 2009",
         "following":false,
         "allow_all_act_msg":false,
         "geo_enabled":false,
         "verified":true
      }
   }
]

字段说明 - status

  • created_at: 创建时间
  • id: 微博ID
  • text: 微博信息内容
  • source: 微博来源
  • favorited: 是否已收藏
  • truncated: 是否被截断
  • in_reply_to_status_id: 回复ID
  • in_reply_to_user_id: 回复人UID
  • in_reply_to_screen_name: 回复人昵称
  • thumbnail_pic: 缩略图
  • bmiddle_pic: 中型图片
  • original_pic:原始图片
  • user: 作者信息
  • retweeted_status: 转发的博文,内容为status,如果不是转发,则没有此字段

字段说明 - user

  • id: 用户UID
  • screen_name: 微博昵称
  • name: 友好显示名称,同微博昵称
  • province: 省份编码(参考省份编码表)
  • city: 城市编码(参考城市编码表)
  • location:地址
  • description: 个人描述
  • url: 用户博客地址
  • profile_image_url: 自定义图像
  • domain: 用户个性化URL
  • gender: 性别,m--男,f--女,n--未知
  • followers_count: 粉丝数
  • friends_count: 关注数
  • statuses_count: 微博数
  • favourites_count: 收藏数
  • created_at: 创建时间
  • following: 是否已关注(此特性暂不支持)
  • verified: 加V标示,是否微博认证用户

使用示例

需修改appkey

  • xml:

curl -u uid:password "http://api.t.sina.com.cn/statuses/user_timeline.xml?screen_name=timyang&source=appkey"

  • json:

curl -u uid:password "http://api.t.sina.com.cn/statuses/user_timeline.json?screen_name=timyang&source=appkey"

Java示例

请从 微博SDK开发包下载 下载Java SDK
代码示例如下:

package weibo4j.examples;

import java.util.List;
import weibo4j.Status;
import weibo4j.Weibo;
import weibo4j.WeiboException;

public class GetUserTimeline {

	/**
	 * 获取用户发布的微博信息列表 
	 * @param args
	 */
	public static void main(String[] args) {
		System.setProperty("weibo4j.oauth.consumerKey", Weibo.CONSUMER_KEY);
    		System.setProperty("weibo4j.oauth.consumerSecret", Weibo.CONSUMER_SECRET);
	 	try {
			//获取24小时内前20条用户的微博信息;args[2]:用户ID
			List<Status> statuses = getWeibo(false,args).getUserTimeline(args[2]);
			for (Status status : statuses) {
	            System.out.println(status.getUser().getName() + ":" +
	                               status.getText());
	        }
		} catch (WeiboException e) {
			e.printStackTrace();
		}
	}
	
 	private static Weibo getWeibo(boolean isOauth,String[] args) {
		Weibo weibo = new Weibo();
		if(isOauth) {//oauth验证方式 args[0]:访问的token;args[1]:访问的密匙
			weibo.setToken(args[0], args[1]);
		}else {//用户登录方式
    		weibo.setUserId(args[0]);//用户名/ID
    		weibo.setPassword(args[1]);//密码
		}
		return weibo;
	}

}

PHP示例

请从 微博SDK开发包下载 处下载PHP SDK(支持OAuth验证之版本)
代码示例如下:

//Statuses/user timeline
//获取24小时内前20条用户的微博信息
$c = new WeiboClient( WB_AKEY , 
                      WB_SKEY , 
                      $_SESSION['last_key']['oauth_token'] , 
                      $_SESSION['last_key']['oauth_token_secret']  );

//$u_id:用户ID
$u_id = "用户ID";
$msg  = $c->user_timeline($u_id);
if ($msg === false || $msg === null){
	echo "Error occured";
	return false;
}
if (isset($msg['error_code']) && isset($msg['error'])){
	echo ('Error_code: '.$msg['error_code'].';  Error: '.$msg['error'] );
	return false;
}
foreach ($msg as $data){
	$user_name = $data['user']['name'];
	$text = $data['text'];
	echo $user_name."=".$text.";";
}