Direct messages/new

跳转到: 导航, 搜索
(请求参数)
 
(未显示5个用户的20个中间版本)
第1行: 第1行:
== 发送私信 ==
+
{{api_desc2|
发送一条私信。必须包含参数user和text,请求必须使用POST方式提交。成功将返回完整的发送消息。
+
uri=direct_messages/new|
 
+
desc=发送一条私信,请求必须使用POST方式提交。发送成功将返回完整的私信消息,包括发送者和接收者的详细信息。|
=== URL===
+
format=XML/JSON|
http://api.t.sina.com.cn/direct_messages/new.format
+
httpMethod=POST|
+
needAuth=true|
===格式===
+
rateLimit=true|
xml, json
+
params={{api_args|id|true|int64/string|私信接收方的用户ID(int64)或者微博昵称(string)}}
+
{{api_args|text|true|string|要发生的消息内容,需要做URLEncode,文本大小必须小于300个汉字。}}
=== HTTP请求方式===
+
{{api_args|user_id|false|int64|私信接收方的用户ID,在用户ID与微博昵称容易混淆的时候,建议使用该参数。}}
POST
+
{{api_args|screen_name|false|string|私信接收方的微博昵称,在用户ID与微博昵称容易混淆的时候,建议使用该参数。}}|
+
getParam=|
===是否需要身份验证===
+
postParam=-d "id=11051&text=Congratulations!"|
true
+
result=
+
===XML示例===
===请求数限制===
+
<pre>
false
+
<?xml version="1.0" encoding="UTF-8"?>
+
<direct_message>
===请求参数===
+
   <created_at>Mon Dec 06 11:19:09 +0800 2010</created_at>
* id:  必须参数.  UID或账户名. 为了支持数字的账户名,需选填写下面2个参数screen_name或user_id:
+
   <id>722704713</id>
* screen_name: 账户名
+
   <text>Congratulations!</text>
* user_id: 新浪UID
+
   <sender_id>1658122963</sender_id>
* text:  必须参数.  要发生的消息内容,需要做URLEncode,文本大小必须小于300个汉字.
+
   <recipient_id>11051</recipient_id>
 
+
   <sender_screen_name>zhangwei217245</sender_screen_name>
===使用说明===
+
   <recipient_screen_name>微博开放平台</recipient_screen_name>
* 此接口问更新受限接口,越权将返回http 403 错误
+
* This method is subject to update limits. A HTTP 403 will be returned if this limit has been hit.
+
 
+
===Response ===
+
XML示例:
+
<?xml version="1.0" encoding="UTF-8"?>
+
<direct_message>
+
   <id>88619848</id>
+
   <sender_id>11075</sender_id>
+
   <text>hi,最近好呢?</text>
+
   <recipient_id>10503</recipient_id>
+
   <created_at>Wed Nov 18 20:30:04 +0000 2009</created_at>
+
   <sender_screen_name>zhulei</sender_screen_name>
+
   <recipient_screen_name>timyang</recipient_screen_name>
+
 
   <sender>
 
   <sender>
     <id>11075</id>
+
     <id>1658122963</id>
     <screen_name>zhulei</screen_name>
+
     <screen_name>zhangwei217245</screen_name>
     <name>Zhu Lei</name>
+
     <name>zhangwei217245</name>
     <location>广州</location>
+
    <province>11</province>
     <description> </description>
+
    <city>5</city>
     <profile_image_url>http://tt8.sinaimg.cn/11075/50/1256307436</profile_image_url>
+
     <location>北京 朝阳区</location>
     <followers_count>0</followers_count>
+
     <description>ABCDE</description>
     <friends_count>0</friends_count>
+
    <url/>
     <statuses_count>0</statuses_count>
+
     <profile_image_url>http://tp4.sinaimg.cn/1658122963/50/1282754213</profile_image_url>
     <favourites_count>0</favourites_count>
+
    <domain>zhangwei217245</domain>
  </sender>
+
    <gender>m</gender>
 +
     <followers_count>24</followers_count>
 +
     <friends_count>44</friends_count>
 +
     <statuses_count>118</statuses_count>
 +
     <favourites_count>3</favourites_count>
 +
    <created_at>Tue Nov 03 00:00:00 +0800 2009</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>Sat Dec 04 23:35:20 +0800 2010</created_at>
 +
      <id>4087921127</id>
 +
      <text>动物丛书的由来。。。http://sinaurl.cn/hbVjvr</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/>
 +
      <annotations/>
 +
    </status>
 +
  </sender>
 
   <recipient>
 
   <recipient>
  <id>10503</id>
+
    <id>11051</id>
     <screen_name>timyang</screen_name>
+
     <screen_name>微博开放平台</screen_name>
     <name>Tim Yang</name>
+
     <name>微博开放平台</name>
     <location>广州</location>
+
    <province>11</province>
     <description>blog: timyang.net</description>
+
    <city>8</city>
     <profile_image_url>http://tt8.sinaimg.cn/10503/50/1256306049</profile_image_url>
+
     <location>北京 海淀区</location>
     <followers_count>0</followers_count>
+
     <description>新浪微博开放平台市场推广官方账号,如有技术问题,请@微博API或者发私信给微博API</description>
     <friends_count>0</friends_count>
+
    <url>http://open.t.sina.com.cn/</url>
     <statuses_count>0</statuses_count>
+
     <profile_image_url>http://tp4.sinaimg.cn/11051/50/1280283165/1</profile_image_url>
 +
    <domain>openapi</domain>
 +
    <gender>m</gender>
 +
     <followers_count>13366</followers_count>
 +
     <friends_count>5</friends_count>
 +
     <statuses_count>158</statuses_count>
 
     <favourites_count>0</favourites_count>
 
     <favourites_count>0</favourites_count>
  </recipient>
+
    <created_at>Wed Jan 20 00:00:00 +0800 2010</created_at>
</direct_message>
+
    <following>false</following>
 +
    <verified>true</verified>
 +
    <allow_all_act_msg>true</allow_all_act_msg>
 +
    <geo_enabled>true</geo_enabled>
 +
    <status>
 +
      <created_at>Mon Nov 29 16:08:43 +0800 2010</created_at>
 +
      <id>3958728723</id>
 +
      <text>各位开发者,我们的论坛上线啦~http://sinaurl.cn/h4FWc7 欢迎大家的参与~另外,关于技术相关的问题,可以在论坛上提出,也可以@微博API 这个官方技术支持账号哦~感谢大家对开放平台的支持~[呵呵]</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/>
 +
    </status>
 +
  </recipient>
 +
</direct_message>
 +
</pre>
 +
===JSON示例===
 +
<pre>
 +
{
 +
    "sender_screen_name" : "zhangwei217245",
 +
    "recipient_screen_name" : "微博开放平台",
 +
    "text" : "Wow~~~Congratulations!",
 +
    "recipient" :
 +
    {
 +
        "name" : "微博开放平台",
 +
        "domain" : "openapi",
 +
        "geo_enabled" : true,
 +
        "followers_count" : 13366,
 +
        "statuses_count" : 158,
 +
        "favourites_count" : 0,
 +
        "city" : "8",
 +
        "description" : "新浪微博开放平台市场推广官方账号,如有技术问题,请@微博API或者发私信给微博API",
 +
        "verified" : true,
 +
        "status" :
 +
        {
 +
            "created_at" : "Mon Nov 29 16:08:43 +0800 2010",
 +
            "text" : "各位开发者,我们的论坛上线啦~http://sinaurl.cn/h4FWc7 欢迎大家的参与~另外,关于技术相关的问题,可以在论坛上提出,也可以@微博API 这个官方技术支持账号哦~感谢大家对开放平台的支持~[呵呵]",
 +
            "truncated" : false,
 +
            "in_reply_to_status_id" : "",
 +
            "in_reply_to_screen_name" : "",
 +
            "geo" : null,
 +
            "favorited" : false,
 +
            "in_reply_to_user_id" : "",
 +
            "id" : 3958728723,
 +
            "source" : "<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>"
 +
        },
 +
        "id" : 11051,
 +
        "gender" : "m",
 +
        "friends_count" : 5,
 +
        "screen_name" : "微博开放平台",
 +
        "allow_all_act_msg" : true,
 +
        "following" : false,
 +
        "url" : "http://open.t.sina.com.cn/",
 +
        "profile_image_url" : "http://tp4.sinaimg.cn/11051/50/1280283165/1",
 +
        "created_at" : "Wed Jan 20 00:00:00 +0800 2010",
 +
        "province" : "11",
 +
        "location" : "北京 海淀区"
 +
    },
 +
    "sender" :
 +
    {
 +
        "name" : "zhangwei217245",
 +
        "domain" : "zhangwei217245",
 +
        "geo_enabled" : true,
 +
        "followers_count" : 24,
 +
        "statuses_count" : 118,
 +
        "favourites_count" : 3,
 +
        "city" : "5",
 +
        "description" : "ABCDE",
 +
        "verified" : false,
 +
        "status" :
 +
        {
 +
            "created_at" : "Sat Dec 04 23:35:20 +0800 2010",
 +
            "text" : "动物丛书的由来。。。http://sinaurl.cn/hbVjvr",
 +
            "truncated" : false,
 +
            "in_reply_to_status_id" : "",
 +
            "annotations" :
 +
            [
  
===使用示例===
+
            ],
cURL:
+
            "in_reply_to_screen_name" : "",
 
+
            "geo" : null,
curl -u user:password -d "text=all your bases are belong to us&user=user_2" http://api.t.sina.com.cn/direct_messages/new.xml
+
            "favorited" : false,
 +
            "in_reply_to_user_id" : "",
 +
            "id" : 4087921127,
 +
            "source" : "<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>"
 +
        },
 +
        "id" : 1658122963,
 +
        "gender" : "m",
 +
        "friends_count" : 44,
 +
        "screen_name" : "zhangwei217245",
 +
        "allow_all_act_msg" : false,
 +
        "following" : false,
 +
        "url" : "",
 +
        "profile_image_url" : "http://tp4.sinaimg.cn/1658122963/50/1282754213",
 +
        "created_at" : "Tue Nov 03 00:00:00 +0800 2009",
 +
        "province" : "11",
 +
        "location" : "北京 朝阳区"
 +
    },
 +
    "sender_id" : 1658122963,
 +
    "recipient_id" : 11051,
 +
    "id" : 722715041,
 +
    "created_at" : "Mon Dec 06 11:21:31 +0800 2010"
 +
}
 +
</pre>
 +
{{param_DM}}
 +
{{param_user}}|
 +
useAge=
 +
* 为避免重复提交,如果发送的私信与最近发布的一条私信内容相同,将返回400错误。
 +
* 私信的接收方必须是发送方的粉丝。否则无法成功发送私信,系统返回400错误,提示:40017:Error: can't send direct message to user who is not your follower!|
 +
otherInfo=
 +
===Java示例===
 +
请从 [[SDK | 微博SDK开发包下载]] 下载Java SDK<br>
 +
代码示例如下:
 +
package weibo4j.examples;
 +
 +
import weibo4j.DirectMessage;
 +
import weibo4j.Weibo;
 +
import weibo4j.WeiboException;
 +
 +
public class SendDirectMessage {
 +
    /**
 +
    * Usage: java Weibo4j.examples.DirectMessage senderID senderPassword message recipientId
 +
    * @param args String[]
 +
    */
 +
    public static void main(String[] args) {
 +
    System.setProperty("Weibo4j.oauth.consumerKey", Weibo.CONSUMER_KEY);
 +
    System.setProperty("Weibo4j.oauth.consumerSecret", Weibo.CONSUMER_SECRET);
 +
   
 +
        if (args.length < 4) {
 +
            System.out.println("No WeiboID/Password specified.");
 +
            System.out.println("Usage: java Weibo4j.examples.DirectMessage senderID senderPassword  recipientId message");
 +
            System.exit( -1);
 +
        }
 +
        Weibo weibo = new Weibo(args[0], args[1]);
 +
        try {
 +
          DirectMessage message = weibo.sendDirectMessage(args[2], args[3]);
 +
            System.out.println("Direct message successfully sent to " +
 +
                              message.getRecipientScreenName());
 +
            System.exit(0);
 +
        } catch (WeiboException te) {
 +
            System.out.println("Failed to send message: " + te.getMessage());
 +
            System.exit( -1);
 +
        }
 +
    }
 +
}
 +
===PHP示例===
 +
请从 [[SDK | 微博SDK开发包下载]] 处下载PHP SDK(支持OAuth验证之版本)<br>
 +
代码示例如下:
 +
<pre>
 +
//Direct messages/new
 +
$c = new WeiboClient( WB_AKEY ,
 +
                      WB_SKEY ,
 +
                      $_SESSION['last_key']['oauth_token'] ,
 +
                      $_SESSION['last_key']['oauth_token_secret']  );
 +
//user_id
 +
$u_id = "User_ID";
 +
//text
 +
$text = "Text";
 +
$msg = $c->send_dm($u_id,$text);
 +
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;
 +
}
 +
echo("Direct message successfully sent to ".$msg['recipient_screen_name']);
 +
</pre>
 +
}}

2010年12月6日 (一) 11:34的最后版本

目录

direct_messages/new

发送一条私信,请求必须使用POST方式提交。发送成功将返回完整的私信消息,包括发送者和接收者的详细信息。

URL

http://api.t.sina.com.cn/direct_messages/new.(json%7Cxml)

支持格式

XML/JSON

HTTP请求方式

POST

是否需要登录

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

请求数限制

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

请求参数

  必选 类型及范围 说明
source true string 申请应用时分配的AppKey,调用接口时候代表应用的唯一身份。(采用OAuth授权方式不需要此参数)
id true int64/string 私信接收方的用户ID(int64)或者微博昵称(string)
text true string 要发生的消息内容,需要做URLEncode,文本大小必须小于300个汉字。
user_id false int64 私信接收方的用户ID,在用户ID与微博昵称容易混淆的时候,建议使用该参数。
screen_name false string 私信接收方的微博昵称,在用户ID与微博昵称容易混淆的时候,建议使用该参数。

注意事项

  • 为避免重复提交,如果发送的私信与最近发布的一条私信内容相同,将返回400错误。
  • 私信的接收方必须是发送方的粉丝。否则无法成功发送私信,系统返回400错误,提示:40017:Error: can't send direct message to user who is not your follower!

返回结果

XML示例

<?xml version="1.0" encoding="UTF-8"?>
<direct_message>
  <created_at>Mon Dec 06 11:19:09 +0800 2010</created_at>
  <id>722704713</id>
  <text>Congratulations!</text>
  <sender_id>1658122963</sender_id>
  <recipient_id>11051</recipient_id>
  <sender_screen_name>zhangwei217245</sender_screen_name>
  <recipient_screen_name>微博开放平台</recipient_screen_name>
  <sender>
    <id>1658122963</id>
    <screen_name>zhangwei217245</screen_name>
    <name>zhangwei217245</name>
    <province>11</province>
    <city>5</city>
    <location>北京 朝阳区</location>
    <description>ABCDE</description>
    <url/>
    <profile_image_url>http://tp4.sinaimg.cn/1658122963/50/1282754213</profile_image_url>
    <domain>zhangwei217245</domain>
    <gender>m</gender>
    <followers_count>24</followers_count>
    <friends_count>44</friends_count>
    <statuses_count>118</statuses_count>
    <favourites_count>3</favourites_count>
    <created_at>Tue Nov 03 00:00:00 +0800 2009</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>Sat Dec 04 23:35:20 +0800 2010</created_at>
      <id>4087921127</id>
      <text>动物丛书的由来。。。http://sinaurl.cn/hbVjvr</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/>
      <annotations/>
    </status>
  </sender>
  <recipient>
    <id>11051</id>
    <screen_name>微博开放平台</screen_name>
    <name>微博开放平台</name>
    <province>11</province>
    <city>8</city>
    <location>北京 海淀区</location>
    <description>新浪微博开放平台市场推广官方账号,如有技术问题,请@微博API或者发私信给微博API</description>
    <url>http://open.t.sina.com.cn/</url>
    <profile_image_url>http://tp4.sinaimg.cn/11051/50/1280283165/1</profile_image_url>
    <domain>openapi</domain>
    <gender>m</gender>
    <followers_count>13366</followers_count>
    <friends_count>5</friends_count>
    <statuses_count>158</statuses_count>
    <favourites_count>0</favourites_count>
    <created_at>Wed Jan 20 00:00:00 +0800 2010</created_at>
    <following>false</following>
    <verified>true</verified>
    <allow_all_act_msg>true</allow_all_act_msg>
    <geo_enabled>true</geo_enabled>
    <status>
      <created_at>Mon Nov 29 16:08:43 +0800 2010</created_at>
      <id>3958728723</id>
      <text>各位开发者,我们的论坛上线啦~http://sinaurl.cn/h4FWc7 欢迎大家的参与~另外,关于技术相关的问题,可以在论坛上提出,也可以@微博API 这个官方技术支持账号哦~感谢大家对开放平台的支持~[呵呵]</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/>
    </status>
  </recipient>
</direct_message>

JSON示例

{
    "sender_screen_name" : "zhangwei217245",
    "recipient_screen_name" : "微博开放平台",
    "text" : "Wow~~~Congratulations!",
    "recipient" : 
    {
        "name" : "微博开放平台",
        "domain" : "openapi",
        "geo_enabled" : true,
        "followers_count" : 13366,
        "statuses_count" : 158,
        "favourites_count" : 0,
        "city" : "8",
        "description" : "新浪微博开放平台市场推广官方账号,如有技术问题,请@微博API或者发私信给微博API",
        "verified" : true,
        "status" : 
        {
            "created_at" : "Mon Nov 29 16:08:43 +0800 2010",
            "text" : "各位开发者,我们的论坛上线啦~http://sinaurl.cn/h4FWc7 欢迎大家的参与~另外,关于技术相关的问题,可以在论坛上提出,也可以@微博API 这个官方技术支持账号哦~感谢大家对开放平台的支持~[呵呵]",
            "truncated" : false,
            "in_reply_to_status_id" : "",
            "in_reply_to_screen_name" : "",
            "geo" : null,
            "favorited" : false,
            "in_reply_to_user_id" : "",
            "id" : 3958728723,
            "source" : "<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>"
        },
        "id" : 11051,
        "gender" : "m",
        "friends_count" : 5,
        "screen_name" : "微博开放平台",
        "allow_all_act_msg" : true,
        "following" : false,
        "url" : "http://open.t.sina.com.cn/",
        "profile_image_url" : "http://tp4.sinaimg.cn/11051/50/1280283165/1",
        "created_at" : "Wed Jan 20 00:00:00 +0800 2010",
        "province" : "11",
        "location" : "北京 海淀区"
    },
    "sender" : 
    {
        "name" : "zhangwei217245",
        "domain" : "zhangwei217245",
        "geo_enabled" : true,
        "followers_count" : 24,
        "statuses_count" : 118,
        "favourites_count" : 3,
        "city" : "5",
        "description" : "ABCDE",
        "verified" : false,
        "status" : 
        {
            "created_at" : "Sat Dec 04 23:35:20 +0800 2010",
            "text" : "动物丛书的由来。。。http://sinaurl.cn/hbVjvr",
            "truncated" : false,
            "in_reply_to_status_id" : "",
            "annotations" : 
            [

            ],
            "in_reply_to_screen_name" : "",
            "geo" : null,
            "favorited" : false,
            "in_reply_to_user_id" : "",
            "id" : 4087921127,
            "source" : "<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>"
        },
        "id" : 1658122963,
        "gender" : "m",
        "friends_count" : 44,
        "screen_name" : "zhangwei217245",
        "allow_all_act_msg" : false,
        "following" : false,
        "url" : "",
        "profile_image_url" : "http://tp4.sinaimg.cn/1658122963/50/1282754213",
        "created_at" : "Tue Nov 03 00:00:00 +0800 2009",
        "province" : "11",
        "location" : "北京 朝阳区"
    },
    "sender_id" : 1658122963,
    "recipient_id" : 11051,
    "id" : 722715041,
    "created_at" : "Mon Dec 06 11:21:31 +0800 2010"
}

字段说明 - direct_message

  • id: 私信ID
  • text: 私信内容
  • sender_id:发送人UID
  • recipient_id: 接受人UID
  • created_at: 发送时间
  • sender_screen_name: 发送人昵称
  • recipient_screen_name:接受人昵称
  • sender: 发送人信息,参考user说明
  • recipient: 接受人信息,参考user说明

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

其他

Java示例

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

package weibo4j.examples;

import weibo4j.DirectMessage;
import weibo4j.Weibo;
import weibo4j.WeiboException;

public class SendDirectMessage {
   /**
    * Usage: java Weibo4j.examples.DirectMessage senderID senderPassword message recipientId
    * @param args String[]
    */
   public static void main(String[] args) {
   	System.setProperty("Weibo4j.oauth.consumerKey", Weibo.CONSUMER_KEY);
   	System.setProperty("Weibo4j.oauth.consumerSecret", Weibo.CONSUMER_SECRET);
   	
       if (args.length < 4) {
           System.out.println("No WeiboID/Password specified.");
           System.out.println("Usage: java Weibo4j.examples.DirectMessage senderID senderPassword  recipientId message");
           System.exit( -1);
       }
       Weibo weibo = new Weibo(args[0], args[1]);
       try {
          DirectMessage message = weibo.sendDirectMessage(args[2], args[3]);
           System.out.println("Direct message successfully sent to " +
                              message.getRecipientScreenName());
           System.exit(0);
       } catch (WeiboException te) {
           System.out.println("Failed to send message: " + te.getMessage());
           System.exit( -1);
       }
   }
}

PHP示例

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

//Direct messages/new
$c = new WeiboClient( WB_AKEY , 
                      WB_SKEY , 
                      $_SESSION['last_key']['oauth_token'] , 
                      $_SESSION['last_key']['oauth_token_secret']  );
//user_id
$u_id = "User_ID";
//text
$text = "Text";
$msg = $c->send_dm($u_id,$text);
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;
}
echo("Direct message successfully sent to ".$msg['recipient_screen_name']);
文档更新时间: 2010-12-06