Я использую библиотеку HybridAuth. Я хотел бы иметь возможность публиковать сообщения в моем профиле Twitter, прошедшем проверку подлинности, с изображениями.
Метод setUserStatus хорошо работает для автоматической отправки твита.
Я написал следующий метод:
function setUserStatus( $status, $image )
{
//$parameters = array( 'status' => $status, 'media[]' => "@{$image}" );
$parameters = array( 'status' => $status, 'media[]' => file_get_contents($image) );
$response = $this->api->post( 'statuses/update_with_media.json', $parameters );
// check the last HTTP status code returned
if ( $this->api->http_code != 200 ){
throw new Exception( "Update user status failed! {$this->providerId} returned an error. " . $this->errorMessageByStatus( $this->api->http_code ) );
}
}
Сообщение, которое я получаю из твиттера:
Ой, мы получили ошибку: Не удалось обновить статус пользователя! Твиттер вернул ошибку. 403 Forbidden: Запрос понят, но отклонен.
Как я могу получить более точную информацию об ошибке? Кому-нибудь уже удалось отправить картинку, прикрепленную к твиту?
Спасибо !
Хьюго