让我的应用程序的用户发布从一个帐户鸣叫 [英] Allowing my app users to post tweets from a single account

查看:101
本文介绍了让我的应用程序的用户发布从一个帐户鸣叫的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的小国显示在公共交通交通问题的小应用程序:比利时

I have a small application that display traffic issues on public transportation in my small country: Belgium.

我允许用户发出警告所有的人当有列车延迟,比如应用程序所做的系统。

I made a system in the application that allow users to warn all people when there is delay on the trains, for instance.

我想这样做是为了让我信任的用户可以从我的帐户像推特用户X说3分钟火车123456延迟

What I would like to do is to allow my trusted users to tweet from my account something like "User X said 3 minutes delay on train 123456"

所以基本上,我想硬code在code中的Twitter用户名和密码,发送鸣叫,因为我所有的凭据。 (基本上,我还要检查我张贴只有1或2的鸣叫小时)

SO basically, i would like to hardcode the twitter username and password in the code and send the tweet, as I have all the credentials. (basically, I would also check that I post only 1 or 2 tweets an hour)

我看了Twitter的文档,但无法找到任何信息。

I have read the twitter documentation, but couldn't find any information on that.

据认为,通过PHP的可能:

It think that's possible via php:

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $twitter_data);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERPWD, "{$twitter_user}:{$twitter_password}");

从这里开始: http://www.webmaster-source.com/2009/04/05/post-to-twitter-from-a-php-script/

推荐答案

您就必须有自己的服务器,应用程序将消息发送到。在收到的消息,你的应用程序,然后将使用OAuth登录到Twitter和的发布的消息使用的您的凭据

You would have to have your own server that the application sends messages to. Upon receipt of a message, your app would then use oauth to log in to twitter and post the message using your credentials.

有可用于许多不同的语言和Web应用程序的Twitter和/或OAuth的库,所以它应该是pretty容易设置的东西了。

There are twitter and/or oauth libraries available for a lot of different languages and web apps, so it should be pretty easy to set something up.

如果你走这条路,你应该注册的Twitter 广告(服务器)的应用程序,然后你马上有你需要开始键。

If you go this route, you should register your (server) app on twitter, and then you'll have the keys you need to get started.

这篇关于让我的应用程序的用户发布从一个帐户鸣叫的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆