Twitter倒计时推文脚本

时间:2013-02-23 01:37:31

标签: twitter twitter-oauth countdown

我正在尝试运行一个脚本,每天更新一次我的Twitter帐户,说明某个日期还有多少天。我一直在使用here概述的步骤,但还没有成功。该教程中使用的方法可能已过时了吗?

我按照概述上传了abrahams twitteroauth,这是我在tweet.php中使用的代码:

<?php

require_once('config.php');
require_once('twitteroauth/twitteroauth.php');
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);
$today = idate('z', time());
$enddate = idate('z', strtotime('6 June 2013'));
$daysleft = $enddate - $today;

$tweetstr = 'Only ' . $daysleft . ' day';
if ($daysleft > 1) $tweetstr .= 's';
$tweetstr .= " left to this whatever event starts!";

$connection->post('statuses/update', array('status' => $tweetstr));

?>

我将twitter应用设置为读取,写入和引导消息。我忽略了什么吗?我对twitter api很新。

以下是运行脚本时出现的错误日志:

[Sat Feb 23 13:18:20 2013] [error] [client 86.40.89.186] PHP Notice:  Use of undefined constant ACCESS_TOKEN - assumed 'ACCESS_TOKEN' in /var/www/vhosts/darrenmccarra.com/connormccarra.com/lc-tweet-bot/lctweet45i32nd/tweet.php on line 5
[Sat Feb 23 13:18:20 2013] [error] [client 86.40.89.186] PHP Notice:  Use of undefined constant ACCESS_TOKEN_SECRET - assumed 'ACCESS_TOKEN_SECRET' in /var/www/vhosts/darrenmccarra.com/connormccarra.com/lc-tweet-bot/lctweet45i32nd/tweet.php on line 5
[Sat Feb 23 13:18:20 2013] [error] [client 86.40.89.186] PHP Warning:  idate() [<a href='function.idate'>function.idate</a>]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'GMT/0.0/no DST' instead in /var/www/vhosts/darrenmccarra.com/connormccarra.com/lc-tweet-bot/lctweet45i32nd/tweet.php on line 6
[Sat Feb 23 13:18:20 2013] [error] [client 86.40.89.186] PHP Warning:  strtotime() [<a href='function.strtotime'>function.strtotime</a>]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'GMT/0.0/no DST' instead in /var/www/vhosts/darrenmccarra.com/connormccarra.com/lc-tweet-bot/lctweet45i32nd/tweet.php on line 7
[Sat Feb 23 13:18:20 2013] [error] [client 86.40.89.186] PHP Warning:  idate() [<a href='function.idate'>function.idate</a>]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'GMT/0.0/no DST' instead in /var/www/vhosts/darrenmccarra.com/connormccarra.com/lc-tweet-bot/lctweet45i32nd/tweet.php on line 7

0 个答案:

没有答案