I ended up using codebird and not TwitterAPIExchange.php. Please see my answer.
I am racking my brain trying to figure out why my code is not working. I am able to post a status update fine to twitter but when I try and add an image it seems to never post it with the status.
With the many posts about this I have read I have tried them all applying the media examples and none seem to work.
One thing is that many of these posts refer to the API call url being https://api.twitter.com/1.1/statuses/update_with_media.json
which according to this article is depreciated.
The new URL "I think" is just https://api.twitter.com/1.1/statuses/update.json
At this point the status uploads fine, the image never does. Can anyone help me with my code please.
require_once('TwitterAPIExchange.php');
/** Set access tokens here - see: https://dev.twitter.com/apps/ **/
$settings = array(
'oauth_access_token' => "***",
'oauth_access_token_secret' => "***",
'consumer_key' => "***",
'consumer_secret' => "***"
);
$url = "https://api.twitter.com/1.1/statuses/update.json";
$requestMethod = 'POST';
$twimage = '60001276.jpg';
$postfields = array(
'media[]' => "@{$twimage}",
'status' => 'Testing Twitter app'
);
$twitter = new TwitterAPIExchange($settings);
$response = $twitter->buildOauth($url, $requestMethod)
->setPostfields($postfields)
->performRequest();
print_r($response);