我改變我的PHP代碼,以與新的API兼容,我堅持update_with_media。 這是我的代碼:Twitter的API api 1.1 update_with_media
$image = constant('PATH_UPLOAD').$db_data['post_image'];
$connection = new TwitterOAuth(constant('CONSUMER_KEY'), constant('CONSUMER_SECRET'), $db_data['tw_oauth_token'], $db_data['tw_oauth_secret']);
$content = $connection->OAuthRequest('https://api.twitter.com/1.1/account/verify_credentials.json', 'GET', array());
$twitterInfo = json_decode($content);
$resp_tw = $connection->OAuthRequest('https://api.twitter.com/1.1/statuses/update_with_media.json', 'POST',
array(
'status' => html_entity_decode($db_data['post_text'],ENT_QUOTES,'UTF-8'),
'media[]' => "@{$image}"
)
);
,並返回
{"errors":[{"code":189,"message":"Error creating status"}]}
可能是什麼問題/什麼我做錯了嗎?
嗨,您使用的這些thmOAuth的版本?我一直在爲自動推文苦苦掙扎幾天,甚至連這段代碼都無法正常工作。 – ahojvole
@ahojvole here bro https://github.com/themattharris/tmhOAuth – Sendy