本文整理汇总了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());
}
示例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;
}