setOAuthToken() публичный Метод

Set the oAuth-token
public setOAuthToken ( string $token )
$token string The token to use.
Пример #1
0
 /**
  * Prepares the environment before running a test.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->twitter = new Twitter(CONSUMER_KEY, CONSUMER_SECRET);
     $this->twitter->setOAuthToken(OAUTH_TOKEN);
     $this->twitter->setOAuthTokenSecret(OAUTH_TOKEN_SECRET);
 }
Пример #2
0
 /**
  * @return Twitter
  */
 public function getClient()
 {
     if (null == $this->client) {
         $config = app()->setting('twitter');
         $client = new Twitter($config['consumer_key'], $config['consumer_secret']);
         if (!empty($_SESSION['twitter_access_token'])) {
             $token = $_SESSION['twitter_access_token'];
             $client->setOAuthToken($token['oauth_token']);
             $client->setOAuthTokenSecret($token['oauth_token_secret']);
         }
         $this->client = $client;
     }
     return $this->client;
 }
Пример #3
0
<?php

//require
require_once '../../../autoload.php';
require_once 'config.php';
use TijsVerkoyen\Twitter\Twitter;
// create instance
$twitter = new Twitter(CONSUMER_KEY, CONSUMER_SECRET);
// The code below will do the oAuth-dance
//$response = $twitter->oAuthRequestToken('http://classes.dev/TijsVerkoyen/Twitter/tests/');
//if(!isset($_GET['oauth_token'])) $response = $twitter->oAuthAuthorize($response['oauth_token']);
//$response = $twitter->oAuthAccessToken($_GET['oauth_token'], $_GET['oauth_verifier']);
//var_dump($response);
//exit;
$twitter->setOAuthToken(OAUTH_TOKEN);
$twitter->setOAuthTokenSecret(OAUTH_TOKEN_SECRET);
try {
    //  $response = $twitter->statusesMentionsTimeline();
    //  $response = $twitter->statusesUserTimeline();
    //  $response = $twitter->statusesHomeTimeline();
    //  $response = $twitter->statusesRetweetsOfMe();
    //  $response = $twitter->statusesRetweets('21947795900469248');
    //  $response = $twitter->statusesShow('210462857140252672');
    //  $response = $twitter->statusesDestroy('264832934299705344');
    //  $response = $twitter->statusesUpdate('Running the tests.. 私のさえずりを設定する '. time());
    //  $response = $twitter->statusesRetweet('241259202004267009');
    //  @todo $response = $twitter->statusesUpdateWithMedia();
    //  $response = $twitter->statusesOEmbed('240192632003911681');
    //  $response = $twitter->searchTweets('#freebandnames');
    //  $response = $twitter->directMessages();
    //  $response = $twitter->directMessagesSent();