예제 #1
0
<?php

require_once 'twitteroauth/twitteroauth.php';
require_once 'config.php';
require_once '/usr/local/twitter/TomaTwiTest/logic/CommonConf.php';
$today = date("n-j");
$commonConf = new CommonConf();
$birth_author = $commonConf->getBirthAuthor($today);
$dead_author = $commonConf->getDiedAuthor($today);
if (count($birth_author) != 0) {
    $birth_message_array = array();
    foreach ($birth_author as $k => $v) {
        $year_old = date("Y") - $v['birth-year'];
        $author_wiki = "http://ja.wikipedia.org/wiki/" . urlencode($v['author']);
        $birth_message_array[] = "本日" . date("n月j日") . "誕生日の作家は," . $v['author'] . '(' . $author_wiki . ')' . "です。" . '(' . $v['birth-year'] . '年生,生誕' . $year_old . '年).  #' . $v['author'];
    }
}
if (count($dead_author) != 0) {
    $dead_message_array = array();
    foreach ($dead_author as $k => $v) {
        $year_after_dead = date("Y") - $v['dead-year'];
        $author_wiki = "http://ja.wikipedia.org/wiki/" . urlencode($v['author']);
        $dead_message_array[] = "本日" . date("n月j日") . "は," . $v['author'] . '(' . $author_wiki . ')' . "の没後" . $year_after_dead . "年です。  #" . $v['author'];
    }
}
$conn = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);
tweetAuther($conn, $birth_message_array, "Birth");
tweetAuther($conn, $dead_message_array, "Dead");
//var_dump(searchTweetByMessage($conn, "小田実"));
function getBirthAuther($date)
{
예제 #2
0
<?php

require_once '/usr/local/twitter/TomaTwiTest/logic/CommonConf.php';
$commonConf = new CommonConf();
$today = date("n-j");
var_dump($today);
var_dump($commonConf->getDiedAuthor($today));