0

Twitter アカウントを 1 日 1 回更新して、特定の日付まであと何日あるかを示すスクリプトを実行しようとしています。ここで概説されている手順を使用してきましたが、まだ成功していません。そのチュートリアルで使用されている方法はおそらく時代遅れですか?

概説したように 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
4

0 に答える 0