使用curl发送Twitter直接消息

使用curl发送Twitter直接消息,curl,twitter,message,Curl,Twitter,Message,是否可以使用just CURL向twitter中的关注者发送DM消息。我能够手动在帐户之间进行DM。这是我第一次涉足推特应用程序开发,因此非常感谢您的帮助 我在我的系统上尝试了以下命令-用户名/密码用星号标出: curl --insecure --verbose --user *****:***** --data "text=hello_world&screen_name=***" https://api.twitter.com/1.1/direct_messages/ne

是否可以使用just CURL向twitter中的关注者发送DM消息。我能够手动在帐户之间进行DM。这是我第一次涉足推特应用程序开发,因此非常感谢您的帮助

我在我的系统上尝试了以下命令-用户名/密码用星号标出:

curl  --insecure --verbose  --user *****:***** 
--data "text=hello_world&screen_name=***"    
https://api.twitter.com/1.1/direct_messages/new.json
并收到以下答复:

* About to connect() to api.twitter.com port 443 (#0)
*   Trying 199.16.156.231... connected
* Connected to api.twitter.com (199.16.156.231) port 443 (#0)
* libcurl is now using a weak random seed!
* SSLv2, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using AES128-SHA
* Server certificate:
*        subject: C=US, ST=California, L=San Francisco, O=Twitter, Inc., OU=Twitter Security, CN=api.twitter.com
*        start date: 2014-08-03 00:00:00 GMT
*        expire date: 2016-12-31 23:59:59 GMT
*        subjectAltName: api.twitter.com matched
*        issuer: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=Terms of use at https://www.verisign.com/rpa (c)10, CN=VeriSi
gn Class 3 Secure Server CA - G3
*        SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
* Server auth using Basic with user '********'
> POST /1.1/direct_messages/new.json HTTP/1.1
> Authorization: Basic dGF1cGlyaG86c3ltbWV0cnkz
> User-Agent: curl/7.19.5 (IA64-HP-VMS) libcurl/7.19.5 OpenSSL/0.9.7d
> Host: api.twitter.com
> Accept: */*
> Content-Length: 32
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 400 Bad Request
< content-length: 62
< content-type: application/json; charset=utf-8
< date: Fri, 29 Apr 2016 09:37:05 GMT
< server: tsa_b
< set-cookie: guest_id=v1%3A146192262515114070; Domain=.twitter.com; Path=/; Expires=Sun, 29-Apr-2018 09:37:05 UTC
< strict-transport-security: max-age=631138519
< x-connection-hash: dcb0fd08d7bd0a64a0be40c7552ee0de
< x-response-time: 5
< x-tsa-request-body-time: 0
<
{"errors":[{"code":215,"message":"Bad Authentication data."}]}
                                                              * Connection #0 to host api.twitter.com left intact
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):
*即将()连接到api.twitter.com端口443(#0)
*正在尝试199.16.156.231。。。有联系的
*已连接到api.twitter.com(199.16.156.231)端口443(#0)
*libcurl现在使用的是弱随机种子!
*SSLv2,客户端你好(1):
*SSLv3,TLS握手,服务器hello(2):
*SSLv3,TLS握手,证书(11):
*SSLv3,TLS握手,服务器完成(14):
*SSLv3、TLS握手、客户端密钥交换(16):
*SSLv3,TLS更改密码,客户端你好(1):
*SSLv3,TLS握手,完成(20):
*SSLv3,TLS更改密码,客户端你好(1):
*SSLv3,TLS握手,完成(20):
*使用AES128-SHA的SSL连接
*服务器证书:
*主题:C=US,ST=California,L=San Francisco,O=Twitter,Inc.,OU=Twitter安全,CN=api.Twitter.com
*开始日期:2014-08-03 00:00:00 GMT
*到期日期:2016-12-31 23:59:59 GMT
*subjectAltName:api.twitter.com匹配
*发卡机构:C=US,O=VeriSign,Inc.,OU=VeriSign Trust Network,OU=at的使用条款https://www.verisign.com/rpa (c) 10,CN=VeriSi
gn 3级安全服务器CA-G3
*SSL证书验证结果:无法获取本地颁发者证书(20),仍在继续。
*与用户'********'一起使用Basic进行服务器身份验证
>POST/1.1/direct_messages/new.json HTTP/1.1
>授权:基本dGF1cGlyaG86c3ltbWV0cnkz
>用户代理:curl/7.19.5(IA64-HP-VMS)libcurl/7.19.5 OpenSSL/0.9.7d
>主持人:api.twitter.com
>接受:*/*
>内容长度:32
>内容类型:application/x-www-form-urlencoded
>
是的,这是可能的

下面是我刚刚尝试的cURL命令,它很有效


curl——请求“发布”https://api.twitter.com/1.1/direct_messages/new.json“--data'screen_name=(TWITTER ID)和text=hello%2C+tworld.+欢迎+加入+1.1.”--header'Authorization:OAuth-OAuth_-consumer_-key=“**********************************”,OAuth_-nonce=“****************************”,OAuth_-signature=“****************************”,OAuth_-signature u-method,oauthèu timestamp=“*************************”,oauthèu token=“*******************************”,oauthèu version=“1.0”-verbose
谢谢,但生成的键似乎是一次点击,一两分钟后过期。我需要一些我可以随时重复使用并自动化的东西。我会自己尝试一种新方法,然后回到Youthy使用temboo api。如果你喜欢这个答案,请向我竖起大拇指