开发者

Twitter API, from database to twitter

I wish to send a tweet (status, update) to / from ONE PARTICULAR twitter account hourly from a mysql database.开发者_如何学运维 I have messed around with the twitter api & oAuth before and it is a real big headache. I just want to have one account hardwired into the code. The hourly part means automation / CRON, however i've never messed with CRON. I see all of the pieces of what I'm trying to accomplish I just need a little shove in the right direction. Any help / tutorials / pointers regarding this would be a great help. PHP is my main language of choice.


Twitter:

1.) Go to dev.twitter.com, login with the account you want to use, create an app, then under app settings write down consumer key, consumer secret and oauth token/ouath token secret.

2.) use this script https://github.com/abraham/twitteroauth

$client = new TwitterOAuth($consumer_key, $consumer_secret, $oauth_token, $oauth_secret);

Then use API documentation for whatever you need https://dev.twitter.com/docs/api

ex. Tweeting: $client->post('statuses/update', array('status' => 'tweet text'));

Cron:

Most shared hostings provide an easy-to-setup cron from cpanel, check it first. If it's not available, then you need to login via SSH and use crontab -e then for once every hour add 0 * * * *

Read up on it here http://en.wikipedia.org/wiki/Cron

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜