我使用以下代码在linkedin个人资料上发布分享帖。
function share($comment, $title, $url, $imageUrl) {
$shareUrl = $this->base_url . "/v1/people/~/shares";
$xml = "<share>
<comment>$comment</comment>
<content>
<title>$title</title>
<submitted-url>$url</submitted-url>
<submitted-image-url>$imageUrl</submitted-image-url>
</content>
<visibility>
<code>anyone</code>
</visibility>
</share>";
$request = OAuthRequest::from_consumer_and_token($this->consumer, $this->access_token, "POST", $shareUrl);
$request->sign_request($this->signature_method, $this->consumer, $this->access_token);
$auth_header = $request->to_header("https://api.linkedin.com");
if ($debug) {
echo $xml . "\n";
echo $auth_header . "\n";
}
$response = $this->httpRequest($shareUrl, $auth_header, "POST", $xml);
return $response;
}
但我收到此错误
{ "errorCode": 0, "message": "[unauthorized]. The token used in the OAuth request is not valid. consumerKey: 81zzkab8nsixp6", "requestId": "GILZJ3Q4MV", "status": 401, "timestamp": 1473170097823 }
1{ "errorCode": 0, "message": "[unauthorized]. OAU:81zzkab8nsixp6|c89e142b-2525-487c-849d-eeaffca04b09|*01|*01:1473170099:V1l36ga90ipTNGKqmQ4OzUKxfoA=", "requestId": "8QWY8GGCCH", "status": 401, "timestamp": 1473170098235 }
任何人都可以帮忙解决这个错误吗?