【发布时间】:2015-11-10 06:08:08
【问题描述】:
当我尝试向 Dropbox API (v2) 发出简单的 curl 请求时,我收到此错误:
Error in call to API function "users/get_current_account": Bad HTTP "Content-Type" header: "application/x-www-form-urlencoded". Expecting one of "application/json", "application/json; charset=utf-8", "text/plain; charset=dropbox-cors-hack".
PHP 代码:
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_URL, "https://api.dropboxapi.com/2/users/get_current_account" );
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer " . $accessToken) );
echo curl_exec($ch);
curl_close($ch);
【问题讨论】:
标签: php dropbox-api