博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
使用cURL远程进行Twitter直接消息传递
阅读量:2511 次
发布时间:2019-05-11

本文共 4548 字,大约阅读时间需要 15 分钟。

Twitter DM

Twitter's direct messaging functionality is great. While simple tweeting communicates "just a clever quip," direct messaging communicates "listen here b*tch, this is important enough that you need to get this message NOW via text message." Twitter's API allows you direct message remotely so now you can let your website DM you (and call you a b*tch) any time you want!

Twitter的直接消息传递功能很棒。 简单的推文交流“只是一个聪明的傻瓜”,而直接消息传递则交流“在这里听,这很重要,以至于您需要立即通过文本消息获得此消息”。 Twitter的API允许您远程定向消息,因此,现在您可以随时让您的网站DM您(并称您为ab * tch)!

Shell cURL命令 (The Shell cURL Command)

curl -u davidwalshblog:myPass -d "text=Testing a remote direct message via CURL&user=fellowTweeter" http://twitter.com/direct_messages/new.xml

This example shows the cURL command as you'd type it in the terminal.

此示例显示了在终端中键入cURL命令的过程。

PHP用法 (PHP Usage)

$result = shell_exec('curl -u davidwalshblog:myPass -d "text=Testing a remote direct message via CURL&user=fellowTweeter" http://twitter.com/direct_messages/new.xml');This is how you could use the command in PHP.

样本XML响应 (Sample XML Response)

186275699
15759583
Testing a direct message.
15759583
Sat Jun 20 00:13:41 +0000 2009
davidwalshblog
davidwalshblog
15759583
davidwalshblog
davidwalshblog
Madison, WI, US
Flexile Programmer, MooTools Core Team Member, JavaScript Fanatic, CSS Tinkerer, PHP Hacker, and web lover.
http://s3.amazonaws.com/twitter_production/profile_images/57860553/footer-logo_normal.jpg
https://davidwalsh.name
false
1834
EEEEEE
000000
2A447B
CDCDCD
999999
20
Thu Aug 07 04:18:53 +0000 2008
3
-21600
Central Time (US & Canada)
http://s3.amazonaws.com/twitter_production/profile_background_images/15318223/twitter-background.png
false
1734
false
false
false
15759583
davidwalshblog
davidwalshblog
Madison, WI, US
Flexile Programmer, MooTools Core Team Member, JavaScript Fanatic, CSS Tinkerer, PHP Hacker, and web lover.
http://s3.amazonaws.com/twitter_production/profile_images/57860553/footer-logo_normal.jpg
https://davidwalsh.name
false
1834
EEEEEE
000000
2A447B
CDCDCD
999999
20
Thu Aug 07 04:18:53 +0000 2008
3
-21600
Central Time (US & Canada)
http://s3.amazonaws.com/twitter_production/profile_background_images/15318223/twitter-background.png
false
1734
false
false
false
/direct_messages/new.xml
You cannot send messages to users who are not following you.

Loads of information if your DM is successful -- a simple error response if your attempt fails.

如果您的DM成功,则会加载大量信息-如果尝试失败,则是简单的错误响应。

So why automate a DM? I think one handy time to implement direct message automation is when you want to receive text messages when events occur on the website. Say you're a salesperson and you have a "request a phone call" form on your site. Since you're out of the office much of the day (driving), you don't have the means to check your email. Instead of setting up a text messaging / SMS system, simply set up a Twitter account and take advantage of Twitter's texting capabilities.

那么,为什么要自动化DM? 我认为实现直接消息自动化的一个方便时间是当您希望在网站上发生事件时接收文本消息时。 假设您是销售人员,并且在您的网站上有一个“请求电话”表格。 由于您一天中大部分时间不在办公室(开车),因此您无法检查电子邮件。 无需设置短信/ SMS系统,只需设置一个Twitter帐户并利用Twitter的短信功能即可。

Would you ever want automated tweets or direct messages from your website?

您是否要从网站上自动发送推文或直接发送消息?

翻译自:

转载地址:http://xkpwd.baihongyu.com/

你可能感兴趣的文章
洛谷 P1059 明明的随机数
查看>>
window自动任务实现数据库定时备份
查看>>
Windows 7 Ultimate(旗舰版)SP1 32/64位官方原版下载(2011年5月12日更新版)
查看>>
javascript操作cookie
查看>>
深入理解HTTP协议(转)
查看>>
NHibernate讲解
查看>>
客户端—表单验证信息—并能否提交到数据库
查看>>
Android开发环境搭建(原创)
查看>>
java IO流 对文件操作的代码集合
查看>>
js / jquery 获取和设置 FCK Editor 的值
查看>>
sql-leetcode Consecutive Numbers
查看>>
C# winform DataGridView操作 (转)
查看>>
一致性Hash算法及使用场景
查看>>
JS - Lexical Structure
查看>>
【2】oracle创建表空间
查看>>
剑指offer-二叉树中和为某一值的路径
查看>>
Java反射机制
查看>>
Python 正则表达式
查看>>
C++ AppendMenu
查看>>
在所选中的物体中取消选中一些物体.txt
查看>>