Created
September 18, 2010 13:06
-
-
Save riaf/585649 to your computer and use it in GitHub Desktop.
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 | |
require_once 'Services/Twitter.php'; | |
require_once 'HTTP/OAuth/Consumer.php'; | |
try { | |
$twitter = new Services_Twitter(); | |
// コマンドラインで叩くくらいならば,OAuth の鍵は全部定義しちゃってもいいかな..とか。 | |
// ウェブアプリにするならば,きちんと authorize するべきですね。 | |
$oauth = new HTTP_OAuth_Consumer( | |
'consumer_key', | |
'consumer_secret', | |
'access_token', | |
'access_token_secret'); | |
// OAuth をセット | |
$twitter->setOAuth($oauth); | |
// 発言する | |
$twitter->statuses->update("「ああ、俺が作った」"); | |
} catch (Services_Twitter_Exception $e) { | |
// エラー | |
echo $e->getMessage(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment