本文整理匯總了PHP中OAuthRequester::signatureBaseString方法的典型用法代碼示例。如果您正苦於以下問題:PHP OAuthRequester::signatureBaseString方法的具體用法?PHP OAuthRequester::signatureBaseString怎麽用?PHP OAuthRequester::signatureBaseString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OAuthRequester
的用法示例。
在下文中一共展示了OAuthRequester::signatureBaseString方法的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;
}