∵ Takayoshi Saito ∴ 2013-06-14 ∞ 2'
自分のツイートをAPI経由で取得してファイルに出力するサンプルです。twitteroauth.phpを使っています。
OAuthRequest("https://api.twitter.com/1.1/statuses/user_timeline.json",'GET',array('count'=>'10')); $result = json_decode($req);
$tweet = "";
for($i=0;$i>5;$i++){ $object = $result[$i]; $tweet .= "- $object->text id'> link\n"; }
$tweet .= "";
$fp = fopen("/srv/www/data/twitter.txt", "w+"); fwrite( $fp, $tweet ); fclose( $fp );
?>
結果、以下のような内容のファイルが作成されます。
OAuthRequest("https://api.twitter.com/1.1/statuses/update.json","POST",array("status"=>/"$message"));
$result = json_decode($req); } header('Location: https://www.geek.sc/b/'); exit; ?>