Friendships/destroy (升级)

跳转到: 导航, 搜索
(创建新页面为 '== friendships/destroy == 取消关注某用户。成功则返回被取消关注人的资料,失败则返回一条字符串的说明。 === URL=== http://api.t.sina.com.cn/fr…')
 
 
(未显示3个用户的4个中间版本)
第1行: 第1行:
== friendships/destroy ==
+
{{api_desc2|
取消关注某用户。成功则返回被取消关注人的资料,失败则返回一条字符串的说明。
+
uri=friendships/destroy|
 
+
desc=取消对某用户的关注,或者取消某用户对自己的关注。|
=== URL===
+
format=XML/JSON|
http://api.t.sina.com.cn/friendships/destroy/id.format
+
httpMethod=POST/DELETE|
+
needAuth=true|
===格式===
+
rateLimit=true|
xml, json
+
params={{api_args|:id|false|int64/string|要取消关注的用户ID(int64)或者微博昵称(string),该参数是一个REST风格的参数。用法见注意事项}}
+
{{api_args|user_id|false|int64|要取消关注的用户ID,为了避免用户的ID与微博昵称相同而产生混淆的情况,推荐使用该参数。}}
=== HTTP请求方式===
+
{{api_args|screen_name|false|string|要取消关注的用户微博昵称,为了避免用户的ID与微博昵称相同而产生混淆的情况,推荐使用该参数。}}
POST, DELETE
+
{{api_args_colspan|1=<font style="color:#ee3333">:id、user_id、screen_name这三个参数必填其一。</font>}}
+
{{api_args|is_follower|false|int|默认为0。1表示取消对方对自己的关注(即移除粉丝)。0表示取消自己对对方的关注(即移除关注)。}}|
===是否需要身份验证===
+
getParam=|
true
+
postParam=-d "user_id=uid"|
+
result=
===请求数限制===
+
===XML示例===
false
+
+
===请求参数===
+
下面的参数必须有其中一个:
+
* id.  必填参数. 要取消关注的用户UID或微博昵称 
+
o 示例: http://api.t.sina.com.cn/friendships/destroy/12345.json or http://api.t.sina.com.cn/friendships/destroy/bob.xml
+
* user_id. 必填参数. 要取消关注的用户UID,主要是用在区分用户UID跟微博昵称一样,产生歧义的时候。 
+
o 示例: http://api.t.sina.com.cn/friendships/destroy.xml?user_id=1401881
+
* screen_name. 必填参数. 要取消的微博昵称,主要是用在区分用户UID跟微博昵称一样,产生歧义的时候。
+
o 示例: http://api.t.sina.com.cn/friendships/destroy.xml?screen_name=101010
+
 
+
===返回结果===
+
 
+
====XML====
+
 
<pre>
 
<pre>
 
<?xml version="1.0" encoding="UTF-8"?>
 
<?xml version="1.0" encoding="UTF-8"?>
 
<user>
 
<user>
   <id>1266321801</id>
+
   <id>1474388131</id>
   <screen_name>姚晨</screen_name>
+
   <screen_name>.......</screen_name>
   <name>姚晨</name>
+
   <name>.......</name>
 
   <province>11</province>
 
   <province>11</province>
   <city>5</city>
+
   <city>8</city>
   <location>北京 朝阳区</location>
+
   <location>北京 海淀区</location>
   <description>一颗很逊的卤蛋。</description>
+
   <description>.......</description>
   <url>http://blog.sina.com.cn/yaochen</url>
+
   <url>http://1</url>
   <profile_image_url>http://tp2.sinaimg.cn/1266321801/50/1283203855</profile_image_url>
+
   <profile_image_url>http://tp4.sinaimg.cn/1474388131/50/1287032732/1</profile_image_url>
   <domain>yaochen</domain>
+
   <domain>.......</domain>
   <gender>f</gender>
+
   <gender>m</gender>
   <followers_count>2787856</followers_count>
+
   <followers_count>40</followers_count>
   <friends_count>561</friends_count>
+
   <friends_count>97</friends_count>
   <statuses_count>2148</statuses_count>
+
   <statuses_count>88</statuses_count>
   <favourites_count>10</favourites_count>
+
   <favourites_count>0</favourites_count>
   <created_at>Fri Aug 28 00:00:00 +0800 2009</created_at>
+
   <created_at>Tue Jul 13 00:00:00 +0800 2010</created_at>
 
   <following>false</following>
 
   <following>false</following>
   <verified>true</verified>
+
   <verified>false</verified>
 
   <allow_all_act_msg>false</allow_all_act_msg>
 
   <allow_all_act_msg>false</allow_all_act_msg>
   <geo_enabled>false</geo_enabled>
+
   <geo_enabled>true</geo_enabled>
 
   <status>
 
   <status>
     <created_at>Fri Sep 10 09:47:00 +0800 2010</created_at>
+
     <created_at>Mon Dec 06 10:24:28 +0800 2010</created_at>
     <id>2465393025</id>
+
     <id>4116374877</id>
     <text>愿我永远不要失去给他人带来快乐的能力,因为失去它,自己也不可能再拥有快乐。</text>
+
     <text>生死簿上记载,我的寿命还有17437天(约48年)  http://sinaurl.cn/hbyVR6</text>
 
     <source>
 
     <source>
       <a href="http://news.sina.com.cn/wap/wbclient.html#3">iPhone客户端</a>
+
       <a href="http://wanyi.sinaapp.com">玩意网</a>
 
     </source>
 
     </source>
 
     <favorited>false</favorited>
 
     <favorited>false</favorited>
第65行: 第51行:
 
     <in_reply_to_user_id/>
 
     <in_reply_to_user_id/>
 
     <in_reply_to_screen_name/>
 
     <in_reply_to_screen_name/>
     <retweeted_status>
+
     <thumbnail_pic>http://ww1.sinaimg.cn/thumbnail/57e160a3jw6dc2ondgoytg.gif</thumbnail_pic>
      <created_at>Fri Sep 10 08:00:03 +0800 2010</created_at>
+
    <bmiddle_pic>http://ww1.sinaimg.cn/bmiddle/57e160a3jw6dc2ondgoytg.gif</bmiddle_pic>
      <id>2463041144</id>
+
    <original_pic>http://ww1.sinaimg.cn/large/57e160a3jw6dc2ondgoytg.gif</original_pic>
      <text>许多人知道如何享乐,却不知道自己从何时起已不再向别人提供欢乐。(BY阿瑟·赫尔普斯)早安,各位。</text>
+
      <source>
+
        <a href="http://t.sina.com.cn">新浪微博</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://ss16.sinaimg.cn/thumbnail/62914aabt8fdc6a2f6c0f&amp;690</thumbnail_pic>
+
      <bmiddle_pic>http://ss16.sinaimg.cn/bmiddle/62914aabt8fdc6a2f6c0f&amp;690</bmiddle_pic>
+
      <original_pic>http://ss16.sinaimg.cn/orignal/62914aabt8fdc6a2f6c0f&amp;690</original_pic>
+
      <user>
+
        <id>1653689003</id>
+
        <screen_name>新周刊</screen_name>
+
        <name>新周刊</name>
+
        <province>44</province>
+
        <city>1</city>
+
        <location>广东 广州</location>
+
        <description>《新周刊》,中国最新锐的时事生活周刊:观点供应商,视觉开发商,资讯整合商,传媒运营商。</description>
+
        <url>http://blog.sina.com.cn/xinzhoukan</url>
+
        <profile_image_url>http://tp4.sinaimg.cn/1653689003/50/1283204286</profile_image_url>
+
        <domain>neweekly</domain>
+
        <gender>m</gender>
+
        <followers_count>559667</followers_count>
+
        <friends_count>203</friends_count>
+
        <statuses_count>5748</statuses_count>
+
        <favourites_count>10</favourites_count>
+
        <created_at>Wed Oct 14 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>
+
    </retweeted_status>
+
 
   </status>
 
   </status>
 
</user>
 
</user>
 
</pre>
 
</pre>
 
+
===JSON示例===
====JSON====
+
 
<pre>
 
<pre>
 
{
 
{
  "id":1266321801,
+
    "name" : "........",
  "screen_name":"姚晨",
+
    "domain" : ".........",
  "name":"姚晨",
+
    "geo_enabled" : true,
  "province":"11",
+
    "followers_count" : 40,
  "city":"5",
+
    "statuses_count" : 88,
  "location":"北京 朝阳区",
+
    "favourites_count" : 0,
  "description":"一颗很逊的卤蛋。",
+
    "city" : "8",
  "url":"http://blog.sina.com.cn/yaochen",
+
    "description" : ".......",
  "profile_image_url":"http://tp2.sinaimg.cn/1266321801/50/1283203855",
+
    "verified" : false,
  "domain":"yaochen",
+
    "status" :  
  "gender":"f",
+
    {
  "followers_count":2787035,
+
        "created_at" : "Mon Dec 06 10:24:28 +0800 2010",
  "friends_count":561,
+
        "text" : "生死簿上记载,我的寿命还有17437天(约48年)  http://sinaurl.cn/hbyVR6",
  "statuses_count":2148,
+
        "bmiddle_pic" : "http://ww1.sinaimg.cn/bmiddle/57e160a3jw6dc2ondgoytg.gif",
  "favourites_count":10,
+
        "original_pic" : "http://ww1.sinaimg.cn/large/57e160a3jw6dc2ondgoytg.gif",
  "created_at":"Fri Aug 28 00:00:00 +0800 2009",
+
        "truncated" : false,
  "following":false,
+
        "in_reply_to_status_id" : "",
  "allow_all_act_msg":false,
+
        "in_reply_to_screen_name" : "",
  "geo_enabled":false,
+
        "geo" : null,
  "verified":true,
+
        "favorited" : false,
  "status":{
+
        "thumbnail_pic" : "http://ww1.sinaimg.cn/thumbnail/57e160a3jw6dc2ondgoytg.gif",
      "created_at":"Fri Sep 10 09:47:00 +0800 2010",
+
        "in_reply_to_user_id" : "",
      "id":2465393025,
+
        "id" : 4116374877,
      "text":"愿我永远不要失去给他人带来快乐的能力,因为失去它,自己也不可能再拥有快乐。",
+
        "source" : "<a href=\"http://wanyi.sinaapp.com\" rel=\"nofollow\">玩意网</a>"
      "source":"<a href=\"http://news.sina.com.cn/wap/wbclient.html#3\" rel=\"nofollow\">iPhone客户端</a>",
+
    },
      "favorited":false,
+
    "id" : 1474388131,
      "truncated":false,
+
    "gender" : "m",
      "in_reply_to_status_id":"",
+
    "friends_count" : 97,
      "in_reply_to_user_id":"",
+
    "screen_name" : ".......",
      "in_reply_to_screen_name":"",
+
    "allow_all_act_msg" : false,
      "geo":null,
+
    "following" : false,
      "retweeted_status":{
+
    "url" : "http://1",
        "created_at":"Fri Sep 10 08:00:03 +0800 2010",
+
    "profile_image_url" : "http://tp4.sinaimg.cn/1474388131/50/1287032732/1",
        "id":2463041144,
+
    "created_at" : "Tue Jul 13 00:00:00 +0800 2010",
        "text":"许多人知道如何享乐,却不知道自己从何时起已不再向别人提供欢乐。(BY阿瑟·赫尔普斯)早安,各位。",
+
    "province" : "11",
        "source":"<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>",
+
    "location" : "北京 海淀区"
        "favorited":false,
+
        "truncated":false,
+
        "in_reply_to_status_id":"",
+
        "in_reply_to_user_id":"",
+
        "in_reply_to_screen_name":"",
+
        "thumbnail_pic":"http://ss16.sinaimg.cn/thumbnail/62914aabt8fdc6a2f6c0f&690",
+
        "bmiddle_pic":"http://ss16.sinaimg.cn/bmiddle/62914aabt8fdc6a2f6c0f&690",
+
        "original_pic":"http://ss16.sinaimg.cn/orignal/62914aabt8fdc6a2f6c0f&690",
+
        "geo":null,
+
        "user":{
+
            "id":1653689003,
+
            "screen_name":"新周刊",
+
            "name":"新周刊",
+
            "province":"44",
+
            "city":"1",
+
            "location":"广东 广州",
+
            "description":"《新周刊》,中国最新锐的时事生活周刊:观点供应商,视觉开发商,资讯整合商,传媒运营商。",
+
            "url":"http://blog.sina.com.cn/xinzhoukan",
+
            "profile_image_url":"http://tp4.sinaimg.cn/1653689003/50/1283204286",
+
            "domain":"neweekly",
+
            "gender":"m",
+
            "followers_count":559667,
+
            "friends_count":203,
+
            "statuses_count":5748,
+
            "favourites_count":10,
+
            "created_at":"Wed Oct 14 00:00:00 +0800 2009",
+
            "following":false,
+
            "allow_all_act_msg":false,
+
            "geo_enabled":false,
+
            "verified":true
+
        }
+
      }
+
  }
+
 
}
 
}
 
</pre>
 
</pre>
 
{{param_user}}
 
{{param_user}}
{{param_status}}
+
{{param_status}}|
 +
useAge=
 +
* :id为REST风格的参数,使用该参数的URL为:<br/> http://api.t.sina.com.cn/friendships/destroy/:id.format <br/> 使用示例如下:<br/> http://api.t.sina.com.cn/friendships/destroy/123456.xml?source=appkey<br/>http://api.t.sina.com.cn/friendships/destroy/123456.json?source=appkey
 +
* 关注不存在的ID返回400
 +
* 如果已经关注了此人,则返回http 403的状态。|
 +
otherInfo=
 +
===Java示例===
 +
请从 [[SDK | 微博SDK开发包下载]] 下载Java SDK<br>
 +
代码示例如下:
 +
<pre>
 +
package weibo4j.examples;
  
===使用示例===
+
import weibo4j.Weibo;
 +
import weibo4j.WeiboException;
  
* xml:
+
public class DestroyFriendship {
curl -u user:password -d "" http://api.t.sina.com.cn/friendships/destroy/11075.xml
+
  
* json:
+
/**
curl -u user:password -d "" http://api.t.sina.com.cn/friendships/destroy/11075.json
+
* 取消关注
 
+
* @param args
====Java示例====
+
*/
请从 [[SDK | 微博SDK开发包下载]] 下载Java SDK<br>
+
public static void main(String[] args) {
 +
System.setProperty("weibo4j.oauth.consumerKey", Weibo.CONSUMER_KEY);
 +
    System.setProperty("weibo4j.oauth.consumerSecret", Weibo.CONSUMER_SECRET);
 +
try {
 +
User user = getWeibo(true,args).destroyFriendship(args[2]);//args[2]:关注用户的id
 +
System.out.println(user.toString());
 +
} 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;
 +
}
 +
}</pre>
 +
===PHP示例===
 +
请从 [[SDK | 微博SDK开发包下载]] 处下载PHP SDK(支持OAuth验证之版本)<br>  
 
代码示例如下:
 
代码示例如下:
package weibo4j.examples;
+
<pre>
+
//friendships/destroy
import weibo4j.Weibo;
+
//取消关注
import weibo4j.WeiboException;
+
$c = new WeiboClient( WB_AKEY ,
+
                      WB_SKEY ,
public class DestroyFriendship {
+
                      $_SESSION['last_key']['oauth_token'] ,  
+
                      $_SESSION['last_key']['oauth_token_secret']  );
/**
+
//关注用户的id
* 取消关注
+
$u_id = "u_id";
* @param args
+
$msg = $c->unfollow($u_id);
*/
+
if ($msg === false || $msg === null){
public static void main(String[] args) {
+
echo "Error occured";
System.setProperty("weibo4j.oauth.consumerKey", Weibo.CONSUMER_KEY);
+
return false;
    System.setProperty("weibo4j.oauth.consumerSecret", Weibo.CONSUMER_SECRET);
+
}
try {
+
if (isset($msg['error_code']) && isset($msg['error'])){
User user = getWeibo(true,args).destroyFriendship(args[2]);//args[2]:关注用户的id
+
echo ('Error_code: '.$msg['error_code'].';  Error: '.$msg['error'] );
System.out.println(user.toString());
+
return false;
} catch (WeiboException e) {
+
}
e.printStackTrace();
+
if (isset($msg['screen_name'])){
}
+
echo('Unfollow Friend:'.$msg['screen_name']);
}
+
}
+
</pre>
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;
+
}
+
}
+

2010年12月13日 (一) 18:58的最后版本

目录

friendships/destroy

取消对某用户的关注,或者取消某用户对自己的关注。

URL

http://api.t.sina.com.cn/friendships/destroy.(json%7Cxml)

支持格式

XML/JSON

HTTP请求方式

POST/DELETE

是否需要登录

true
关于授权机制,参见授权机制声明

请求数限制

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

请求参数

  必选 类型及范围 说明
source true string 申请应用时分配的AppKey,调用接口时候代表应用的唯一身份。(采用OAuth授权方式不需要此参数)
:id false int64/string 要取消关注的用户ID(int64)或者微博昵称(string),该参数是一个REST风格的参数。用法见注意事项
user_id false int64 要取消关注的用户ID,为了避免用户的ID与微博昵称相同而产生混淆的情况,推荐使用该参数。
screen_name false string 要取消关注的用户微博昵称,为了避免用户的ID与微博昵称相同而产生混淆的情况,推荐使用该参数。
:id、user_id、screen_name这三个参数必填其一。
is_follower false int 默认为0。1表示取消对方对自己的关注(即移除粉丝)。0表示取消自己对对方的关注(即移除关注)。

注意事项

返回结果

XML示例

<?xml version="1.0" encoding="UTF-8"?>
<user>
  <id>1474388131</id>
  <screen_name>.......</screen_name>
  <name>.......</name>
  <province>11</province>
  <city>8</city>
  <location>北京 海淀区</location>
  <description>.......</description>
  <url>http://1</url>
  <profile_image_url>http://tp4.sinaimg.cn/1474388131/50/1287032732/1</profile_image_url>
  <domain>.......</domain>
  <gender>m</gender>
  <followers_count>40</followers_count>
  <friends_count>97</friends_count>
  <statuses_count>88</statuses_count>
  <favourites_count>0</favourites_count>
  <created_at>Tue Jul 13 00:00:00 +0800 2010</created_at>
  <following>false</following>
  <verified>false</verified>
  <allow_all_act_msg>false</allow_all_act_msg>
  <geo_enabled>true</geo_enabled>
  <status>
    <created_at>Mon Dec 06 10:24:28 +0800 2010</created_at>
    <id>4116374877</id>
    <text>生死簿上记载,我的寿命还有17437天(约48年)  http://sinaurl.cn/hbyVR6</text>
    <source>
      <a href="http://wanyi.sinaapp.com">玩意网</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://ww1.sinaimg.cn/thumbnail/57e160a3jw6dc2ondgoytg.gif</thumbnail_pic>
    <bmiddle_pic>http://ww1.sinaimg.cn/bmiddle/57e160a3jw6dc2ondgoytg.gif</bmiddle_pic>
    <original_pic>http://ww1.sinaimg.cn/large/57e160a3jw6dc2ondgoytg.gif</original_pic>
  </status>
</user>

JSON示例

{
    "name" : "........",
    "domain" : ".........",
    "geo_enabled" : true,
    "followers_count" : 40,
    "statuses_count" : 88,
    "favourites_count" : 0,
    "city" : "8",
    "description" : ".......",
    "verified" : false,
    "status" : 
    {
        "created_at" : "Mon Dec 06 10:24:28 +0800 2010",
        "text" : "生死簿上记载,我的寿命还有17437天(约48年)  http://sinaurl.cn/hbyVR6",
        "bmiddle_pic" : "http://ww1.sinaimg.cn/bmiddle/57e160a3jw6dc2ondgoytg.gif",
        "original_pic" : "http://ww1.sinaimg.cn/large/57e160a3jw6dc2ondgoytg.gif",
        "truncated" : false,
        "in_reply_to_status_id" : "",
        "in_reply_to_screen_name" : "",
        "geo" : null,
        "favorited" : false,
        "thumbnail_pic" : "http://ww1.sinaimg.cn/thumbnail/57e160a3jw6dc2ondgoytg.gif",
        "in_reply_to_user_id" : "",
        "id" : 4116374877,
        "source" : "<a href=\"http://wanyi.sinaapp.com\" rel=\"nofollow\">玩意网</a>"
    },
    "id" : 1474388131,
    "gender" : "m",
    "friends_count" : 97,
    "screen_name" : ".......",
    "allow_all_act_msg" : false,
    "following" : false,
    "url" : "http://1",
    "profile_image_url" : "http://tp4.sinaimg.cn/1474388131/50/1287032732/1",
    "created_at" : "Tue Jul 13 00:00:00 +0800 2010",
    "province" : "11",
    "location" : "北京 海淀区"
}

字段说明 - 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标示,是否微博认证用户

字段说明 - 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,如果不是转发,则没有此字段

其他

Java示例

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

package weibo4j.examples;

import weibo4j.Weibo;
import weibo4j.WeiboException;

public class DestroyFriendship {

	/**
	 * 取消关注
	 * @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 {
			User user = getWeibo(true,args).destroyFriendship(args[2]);//args[2]:关注用户的id
			System.out.println(user.toString());
		} 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验证之版本)
代码示例如下:

//friendships/destroy
//取消关注
$c = new WeiboClient( WB_AKEY , 
                      WB_SKEY , 
                      $_SESSION['last_key']['oauth_token'] , 
                      $_SESSION['last_key']['oauth_token_secret']  );
//关注用户的id
$u_id = "u_id";
$msg = $c->unfollow($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;
}
if (isset($msg['screen_name'])){
	echo('Unfollow Friend:'.$msg['screen_name']);
}
文档更新时间: 2010-12-13