当前位置: 首页>>代码示例>>PHP>>正文


PHP Api::getConsumerSecret方法代码示例

本文整理汇总了PHP中Api::getConsumerSecret方法的典型用法代码示例。如果您正苦于以下问题:PHP Api::getConsumerSecret方法的具体用法?PHP Api::getConsumerSecret怎么用?PHP Api::getConsumerSecret使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Api的用法示例。


在下文中一共展示了Api::getConsumerSecret方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testClearCredentials

 public function testClearCredentials()
 {
     $this->assertEquals('-', $this->api->getConsumerKey());
     $this->api->clearCredentials();
     $this->assertEquals(null, $this->api->getConsumerKey());
     $this->assertEquals(null, $this->api->getConsumerSecret());
     $this->assertEquals(null, $this->api->getAccessTokenKey());
     $this->assertEquals(null, $this->api->getAccessTokenSecret());
 }
开发者ID:venkat554,项目名称:twitter-1,代码行数:9,代码来源:ApiTest.php

示例2: _request

 /**
  * @param $apiResourceUrl
  * @return mixed
  * @throws \OAuthException
  * @todo Replace this Oauth class from the BuzzStream docs (https://api.buzzstream.com/docs/api_doc.html#auth) with a newer Oauth component that we can composer in.
  */
 protected function _request($apiResourceUrl)
 {
     $consumer_key = Api::getConsumerKey();
     $consumer_secret = Api::getConsumerSecret();
     $consumer = new \OAuthConsumer($consumer_key, $consumer_secret);
     $request = \OAuthRequest::from_consumer_and_token($consumer, NULL, "GET", $apiResourceUrl);
     $sig_method = new \OAuthSignatureMethod_HMAC_SHA1();
     $request->sign_request($sig_method, $consumer, NULL);
     $curl = curl_init();
     curl_setopt($curl, CURLOPT_URL, $request->to_url());
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($curl, CURLOPT_HTTPHEADER, array($request->to_header()));
     $response = curl_exec($curl);
     curl_close($curl);
     $json_response = json_decode($response, true);
     if (!is_array($json_response)) {
         throw new \Exception("JSON response is not an array as expected");
     }
     if (isset($json_response['message'])) {
         throw new \Exception($json_response['message']);
     }
     return $json_response;
 }
开发者ID:goodlinks,项目名称:buzzstream-feed,代码行数:29,代码来源:ApiResource.php


注:本文中的Api::getConsumerSecret方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。