Created
July 14, 2011 10:29
-
-
Save 77web/1082238 to your computer and use it in GitHub Desktop.
opAuthWithTwitterPluginでtwitter同時投稿するライブラリの案
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(dirname(__FILE__).'/TwitterOAuth.class.php'); | |
class opAuthWithTwitterPluginTweet | |
{ | |
protected static $consumer_secret; | |
protected static $consumer_key; | |
protected static $oauth_token; | |
protected static $oauth_secret; | |
protected static $connection; | |
const POST_URI = 'https://twitter.com/statuses/update.xml'; | |
public static function setup($member) | |
{ | |
self::$consumer_key = Doctrine::getTable('SnsConfig')->get('op_auth_TwitterAnywhere_plugin_consumer_key'); | |
self::$consumer_secret = Doctrine::getTable('SnsConfig')->get('op_auth_TwitterAnywhere_plugin_consumer_secret'); | |
self::$oauth_token = $member->getConfig('twitter_oauth_token'); | |
self::$oauth_secret = $member->getConfig('twitter_oauth_token_secret'); | |
self::$connection = new TwitterOAuth(self::$consumer_key, self::$consumer_secret, self::$oauth_token, self::$oauth_secret); | |
} | |
public static function tweet($tweet) | |
{ | |
self::$connection->post(self::POST_URI, array('status'=>$tweet, 'oauth_token'=>self::$oauth_token, 'oauth_secret'=>self::$oauth_secret)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment