當前位置: 首頁>>代碼示例>>PHP>>正文


PHP TwitterOAuth::oauth2方法代碼示例

本文整理匯總了PHP中Abraham\TwitterOAuth\TwitterOAuth::oauth2方法的典型用法代碼示例。如果您正苦於以下問題:PHP TwitterOAuth::oauth2方法的具體用法?PHP TwitterOAuth::oauth2怎麽用?PHP TwitterOAuth::oauth2使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Abraham\TwitterOAuth\TwitterOAuth的用法示例。


在下文中一共展示了TwitterOAuth::oauth2方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Oauth

 public function Oauth()
 {
     $oauth = new TwitterOAuth($this->key, $this->secret);
     $accessToken = $oauth->oauth2('oauth2/token', ['grant_type' => 'client_credentials']);
     $twitter = new TwitterOAuth($this->key, $this->secret, null, $accessToken->access_token);
     return $twitter;
 }
開發者ID:wilrona,項目名稱:ApplicationDT,代碼行數:7,代碼來源:TwitterComponent.php

示例2: refresh

 public function refresh()
 {
     $oauth = new TwitterOAuth(\twitter\configuration::$consumerKey, \twitter\configuration::$consumerSecret);
     $accessToken = $oauth->oauth2('oauth2/token', ['grant_type' => 'client_credentials']);
     $this->twitter = new TwitterOAuth(\twitter\configuration::$consumerKey, \twitter\configuration::$consumerSecret, null, $accessToken->access_token);
     $this->update();
 }
開發者ID:GPierre-Antoine,項目名稱:projetphp,代碼行數:7,代碼來源:Twitter.php

示例3: testOauth2TokenInvalidate

 /**
  * @depends testOauth2Token
  */
 public function testOauth2TokenInvalidate($accessToken)
 {
     $twitter = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
     // HACK: access_token is already urlencoded but gets urlencoded again breaking the invalidate request.
     $result = $twitter->oauth2('oauth2/invalidate_token', array('access_token' => urldecode($accessToken->access_token)));
     $this->assertEquals(200, $twitter->lastHttpCode());
     $this->assertObjectHasAttribute('access_token', $result);
     return $result;
 }
開發者ID:avassilenko,項目名稱:av_2,代碼行數:12,代碼來源:TwitterOAuthTest.php

示例4: __construct

 public function __construct($apiKey, $apiKeySecret)
 {
     $this->apiKey = $apiKey;
     $this->apiKeySecret = $apiKeySecret;
     $oauth = new TwitterOAuth($this->apiKey, $this->apiKeySecret);
     $accessToken = $oauth->oauth2('oauth2/token', ['grant_type' => 'client_credentials']);
     $this->access_token = $accessToken->access_token;
     $this->twitter = new TwitterOAuth($this->apiKey, $this->apiKeySecret, null, $this->access_token);
 }
開發者ID:SalemSaiid,項目名稱:TwitterBundle,代碼行數:9,代碼來源:TwitterApi.php

示例5: testOauth2Token

 public function testOauth2Token()
 {
     $twitter = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
     $result = $twitter->oauth2('oauth2/token', array('grant_type' => 'client_credentials'));
     $this->assertEquals(200, $twitter->getLastHttpCode());
     $this->assertObjectHasAttribute('token_type', $result);
     $this->assertObjectHasAttribute('access_token', $result);
     $this->assertEquals('bearer', $result->token_type);
     return $result;
 }
開發者ID:alexxnotfound,項目名稱:twitter_bot,代碼行數:10,代碼來源:TwitterOAuthTest.php

示例6: initTwitterOAuth

 private function initTwitterOAuth()
 {
     if ($this->twitter != null) {
         return;
     }
     /** Creation de l'objet TwitterOAuth qui me permet de recuperer les tweets */
     $oauth = new TwitterOAuth("rC3gP2pji5zoKoGf4FlUYdvaa", "TYIpFvcb9wR6SrpdxmMCPruiyJSPSDfJdLz6cAlNgqoyMcMq2j");
     $accesstoken = $oauth->oauth2('oauth2/token', ['grant_type' => 'client_credentials']);
     $this->twitter = new TwitterOAuth("rC3gP2pji5zoKoGf4FlUYdvaa", "TYIpFvcb9wR6SrpdxmMCPruiyJSPSDfJdLz6cAlNgqoyMcMq2j", null, $accesstoken->access_token);
 }
開發者ID:alexandre-le-borgne,項目名稱:-PHP-DUT-S3-Projet,代碼行數:10,代碼來源:TwitterModel.php


注:本文中的Abraham\TwitterOAuth\TwitterOAuth::oauth2方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。