This question already has an answer here:
Already I searched for the propose and I found many answer but not helpful , and I posted Text on twitter easily but , when I tried to post Image I got bool(false) Error , the below code I used for posting image but not working till now , kindly help me , what's the error of my code :
<?php
require 'tmhOAuth.php';
require 'tmhUtilities.php';
$tmhOAuth = new tmhOAuth(array(
'consumer_key' => '***************',
'consumer_secret' => '***************',
'user_token' => '***************',
'user_secret' => '***************',
));
$image = 'myImage.jpg';
$code = $tmhOAuth->request('POST', 'https://upload.twitter.com/1/statuses/update_with_media.json',
array(
'media[]' => "@{$image}",
"status" => "Is this working now?"
),
true, // use auth
true // multipart
);
if ($code == 200) {
var_dump(json_decode($tmhOAuth->response['response']));
} else {
var_dump($tmhOAuth->response['response']);
}
?>
My result is :
</div>
You are using the wrong API call.
According to the official documentation the correct request is to:
https://api.twitter.com/1.1/statuses/update_with_media.json
It may also be worth your while to check you're using the latest version of the PHP library.