本文整理匯總了PHP中OAuthRequest::generateTimestamp方法的典型用法代碼示例。如果您正苦於以下問題:PHP OAuthRequest::generateTimestamp方法的具體用法?PHP OAuthRequest::generateTimestamp怎麽用?PHP OAuthRequest::generateTimestamp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OAuthRequest
的用法示例。
在下文中一共展示了OAuthRequest::generateTimestamp方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createFromConsumerAndToken
/**
* Create OAuthRequest from Consumer and Token
*
* @param OAuthConsumer $consumer - OAuthConsumer
* @param OAuthToken $token - OAuthToken
* @param String $httpMethod - http method
* @param String $httpURL - http URL
* @param array|null $parameters - parameters
* @return OAuthRequest
*/
public static function createFromConsumerAndToken($consumer, $token, $httpMethod, $httpURL, $parameters = null)
{
@$parameters or $parameters = array();
$nonce = OAuthRequest::generateNonce();
$timestamp = OAuthRequest::generateTimestamp();
$default = array('oauth_version' => OAuthRequest::VERSION, 'oauth_nonce' => $nonce, 'oauth_timestamp' => $timestamp, 'oauth_consumer_key' => $consumer->getKey());
if ($token) {
$default['oauth_token'] = $token->getKey();
}
$parameters = array_merge($default, $parameters);
$urlParts = parse_url($httpURL);
if (isset($urlParts['query']) && $urlParts['query']) {
$params = OAuthUtils::parseParameterFromString($urlParts['query']);
$parameters = array_merge($params, $parameters);
}
return new OAuthRequest($httpMethod, $httpURL, $parameters, $nonce, $timestamp);
}