我通过使用postman环境设置授权标头来为postman中的公共api请求请求令牌,它给了我请求令牌,但是当我在php curl中设置授权标头时,显示了无效的使用者密钥错误。 >
图片链接:https://i.stack.imgur.com/XeBmp.png
$ch = curl_init();
$url = "https://api.xero.com/oauth/RequestToken";
$headers = array(
'Content-Type: application/json',
'Accept: application/json',
'Authorization:OAuth',
'oauth_consumer_key:key',
'oauth_consumer_secret:secret',
'oauth_signature_method:HMAC-SHA1',
'oauth_signature:udqyOKnf1Qa1mf536i2%2BB4uj5z0%3D',
'oauth_timestamp:'.time(),
'oauth_nonce:t02gAz',
'oauth_version'=>'1.0'
);
curl_setopt($ch , CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$information = curl_getinfo($ch);
print_r($information);
$result = curl_exec($ch);
print_r($result);
if($result === false){
echo "success";
}
else{
//echo "error";
}