在邮递员中,我传递的参数如下
url =' xxxx',身份验证内容为type = OAuth1.0,Consumer Key,Consumer Secret,Token,Token Secret,Timestamp,Nonce,Version = 1.0,Realm = Optional
< / LI>以下是我试过的代码
$url="xxx";
$header[] = 'Content-Type: application/x-www-form-urlencoded';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, urlencode('Authorization:OAuth oauth_consumer_key="xxx",oauth_token="xxx",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1475651061",oauth_nonce="LyA5sR",oauth_version="1.0",oauth_signature="xxx"'));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
if(curl_error($ch))
{
echo 'error:' . curl_error($ch);
}
echo "<pre>";print_r($result);exit;
答案 0 :(得分:0)
你使用的是错误的做法。请查看此文章
答案 1 :(得分:0)
问题在于oauth签名没有正确形成。您可以参考https://oauth.net/core/1.0/以获得更清晰