当前位置: 首页>>代码示例>>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;未经允许,请勿转载。