我已经在pinterst上获取了现有的bords,并获得了Board Id,Board Name和Board URL等信息。 但是我想发布一个带有链接和描述CURL代码的图片 我的错误"授权失败"
我的代码是:
$url_pin = 'https://api.pinterest.com/v1/pins/?board=' . $userName . '/' . $board_name . '&note=' . $post['scheduled_text_message'] . '&link=' . $link . '&image_url=https://www.postsharing.com/img/PostSharing.png';
$ch_pin = curl_init();
curl_setopt($ch_pin, CURLOPT_URL, $url_pin);
curl_setopt($ch_pin, CURLOPT_POST, 1);
curl_setopt($ch_pin, CURLOPT_RETURNTRANSFER, true);
$server_pin = curl_exec($ch_pin);
curl_close($ch_pin);
$decoded_pin = json_decode($server_pin, true);
我得到的json_decoded结果如下: -
Array
(
[status] => failure
[code] => 3
[host] => devplatform-devapi-prod-3c889f83
[generated_at] => Mon, 28 Dec 2015 09:04:02 +0000
[message] => Authorization failed.
[data] =>
)
请有人帮我解决这个问题。 感谢
答案 0 :(得分:1)
您无法通过有效身份验证对某个电路板进行拼凑。并且,用户ID和密码根本不够。
您需要在https://developers.pinterest.com/apps/
的Pinterest Developers上注册您想要发布到您的主板的应用程序拥有App密钥和秘密,您可以获得oAuth访问令牌,阅读http://oauth.net/或https://developers.pinterest.com/docs/api/overview/
拥有有效的oAuth令牌后,请将其添加到上面的网址:
$url_pin = 'https://api.pinterest.com/v1/pins/?board=' . $userName . '/' . $board_name . '&note=' . $post['scheduled_text_message'] . '&link=' . $link . '&image_url=https://www.postsharing.com/img/PostSharing.png&access_token=' + $token;