Skip to content

Instantly share code, notes, and snippets.

@riaf
Created September 18, 2010 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save riaf/585649 to your computer and use it in GitHub Desktop.
Save riaf/585649 to your computer and use it in GitHub Desktop.
<?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