2011-02-14 75 views
0

全部。一個關於google oauth的問題,輸出url總是返回 signature_invalid。我不知道。php google oauth問題

<?php 
$url="https://www.google.com/accounts/OAuthGetRequestToken?"; 

$scope ="scope=".urlencode(sprintf("https://www.google.com/calendar/feeds/%s/settings",urlencode("[email protected]"))); 
$oauth_consumer_key="&oauth_consumer_key=anonymous"; 
$oauth_nonce="&oauth_nonce=1111111111111111111111111111111111111111111111111111111111111111"; 
$oauth_signature_method=sprintf("&oauth_signature_method=%s","HMAC-SHA1"); 
$oauth_timestamp=sprintf("&oauth_timestamp=%s",time()); 
$oauth_signature="&oauth_signature="; 


$base_string = $scope.$oauth_consumer_key.$oauth_nonce.$oauth_signature_method.$oauth_timestamp; 

$call=$url.$base_string; 

$call=$call.$oauth_signature.base64_encode(hash_hmac("sha1",urlencode($base_string),"anonymous",true)); 

echo $call."\n"; 
/* file_get_contents($call); */ 


?> 

我引用 http://oauth.net/core/1.0/#rfc.section.9.1.1http://code.google.com/intl/zh-TW/apis/accounts/docs/OAuth_ref.html#RequestToken

回答