我使用OAuth認證的Dropbox獲得訪問令牌:https://blogs.dropbox.com/developers/2012/07/using-oauth-1-0-with-the-plaintext-signature-method/HTTP請求失敗!與文件獲取內容
但我得到的錯誤信息: 警告:的file_get_contents(https://api.dropbox.com/1/oauth/request_token):未能打開流:HTTP請求失敗! HTTP/1.1 400錯誤的請求
我的PHP代碼:
$Header = json_encode(array('Authorization: OAuth oauth_version="1.0"', "oauth_signature_method" => "PLAINTEXT", "oauth_consumer_key" => "XX", "oauth_signature" => "XX"));
$Options = array('http' =>
array(
'method' => 'POST',
'header' => $Header,
)
);
$Context = stream_context_create($Options);
$Result = file_get_contents("https://api.dropbox.com/1/oauth/request_token", false, $Context);
print_r($Result);
嘗試去CURL。檢查了這一點:http://stackoverflow.com/a/8543512/4388034 –
也檢查這個鏈接,它會解釋你的方式更好的用法:http://fabi.me/en/php-projects/dropphp-dropbox-api -client/comment-page-2/ –