Created
June 23, 2013 10:33
-
-
Save gomasaba/5844552 to your computer and use it in GitHub Desktop.
twitteroauthでツイート取得
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* twitter 表示 | |
* 1時間60回 | |
* 1分のキャッシュ | |
*/ | |
require_once getenv('DOCUMENT_ROOT').'/../lib/twitteroauth/twitteroauth/twitteroauth.php'; | |
$consumer_key = ''; | |
$consumer_secret = ''; | |
$access_token = ''; | |
$access_token_secret = ''; | |
$memcached = new Memcached(); | |
$memcached->addServer("localhost", 11211); | |
if(!$req = $memcached->get('tweet')){ | |
$TwitterOAuth = new TwitterOAuth($consumer_key,$consumer_secret,$access_token,$access_token_secret); | |
$req = $TwitterOAuth->OAuthRequest("https://api.twitter.com/1.1/statuses/user_timeline.json","GET",array( | |
'screen_name'=>'', | |
"count"=>"5" | |
)); | |
$memcached->add('tweet',$req,3600); | |
} | |
header("Content-Type: text/javascript; charset=utf-8"); | |
echo $req; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment