テストついでー
テストついでー
<?php //Tr_Twitのコードをほとんど流用。 set_include_path(realpath('./src') . PATH_SEPARATOR . get_include_path()); require_once './src/Tr/Twit.php'; // OAuthサンプル session_start(); if (isset($_GET['clear'])) session_destroy(); $consumerKey = 'ないしょ'; $consumerSecret = 'ないしょ'; $accessToken = $_SESSION['accessToken']; $accessTokenSecret = $_SESSION['accessTokenSecret']; $tw = Tr_Twit::getOAuth($consumerKey, $consumerSecret); // コールバックURI設定 $uri = ($_SERVER['HTTPS'] === 'on' ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']; $tw->setCallbackUri($uri); // アクセストークンを設定しない、もしくはnullや空白の場合は認証処理を通る $tw->setAccessToken($accessToken, $accessTokenSecret); // 接続確認 ======================================================================================== if (!$tw->checkConnection('storeToken')) { die('認証失敗'); } // API実行処理 ===================================================================================== echo '<pre>'; // 定義済みAPI呼び出し $screen_name = $_GET["scname"]; $page = $_GET["page"]; //$result = $tw->timeline->getUserTimeline(null, null, "ユーザ名"); $result = $tw->timeline->getUserTimeline(null, null, "ユーザ名", null, null, null, 160, null, null, null); header("Content-Type: text/html charset=UTF-8"); echo "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"; echo "<h1>ついーにゃ</h1>"; echo "3200個前のツイートはこんならしいよ<br/>"; foreach( $result as $post ) { $text = $post["text"]; echo "Post:".$text."<br />"; echo "Posted at:".$post["created_at"]."<br />"; echo "<hr />"; } function storeToken($token, $secret) { $_SESSION['accessToken'] = $token; $_SESSION['accessTokenSecret'] = $secret; } ?>