本文整理汇总了PHP中OAuthRequester::calculateDataSignature方法的典型用法代码示例。如果您正苦于以下问题:PHP OAuthRequester::calculateDataSignature方法的具体用法?PHP OAuthRequester::calculateDataSignature怎么用?PHP OAuthRequester::calculateDataSignature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OAuthRequester
的用法示例。
在下文中一共展示了OAuthRequester::calculateDataSignature方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SignUrl
/**
* Given a URL return an OAuth signed URL. This will handle creating a timestamp and nonce
*
* @param string $url the unsigned url
* @param string $method request method GET, POST, PUT, DELETE
* @param string $key oauth key
* @param string $secret oauth secret
* @param array $params querystring or post parameters
* @param string $body the body contents of the request
* @param string $signature_method method used for signature (default = 'HMAC_SHA1')
*/
public static function SignUrl($url, $method, $key, $secret, $params = null, $body = null, $signature_method = 'HMAC_SHA1')
{
$options = array('consumer_key' => $key, 'consumer_secret' => $secret);
$params = $params ? $params : array();
OAuthStore::instance("2Leg", $options);
// Obtain a request object for the request we want to make
$request = new OAuthRequester($url, $method, $params, $body);
$sig = $request->sign($key, null, '');
$data = $request->signatureBaseString();
$url = substr(urldecode($data . '&oauth_signature=' . $request->calculateDataSignature($data, $secret, '', $signature_method)), strlen($method) + 1);
$url = VerySimpleStringUtil::ReplaceFirst('&', '?', $url);
return $url;
}