1
我试图通过PHP/cURL和OAuth2向中文微博网站新浪微博发布status update。 我遇到了此问题:如何通过OAuth2向新浪微博发布状态更新?
{"error":"auth faild!","error_code":21301,"request":"/2/statuses/update.json"}
我的PHP:
<?php
$ch = curl_init('https://api.weibo.com/2/statuses/update.json');
$headers = array(
'Authorization: Bearer '.$access_token,
'Content-Type: application/x-www-form-urlencoded');
$postData = array('access_token' => '2.00x123456789', 'status' => 'hello');
curl_setopt_array($ch, array(
CURLOPT_SSL_VERIFYPEER => FALSE,
CURLOPT_SSL_VERIFYHOST => TRUE,
CURLOPT_POST => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => $postData
));
$response = curl_exec($ch);
echo $response;
curl_close($ch);
?>
我授权使用的OAuth2范围all
应用程序和令牌是有效的。 错误的原因是什么?
我现在真的很开心!非常感谢! – Uli