I\'ve got the following working code, the code simply posts a status and an image om my twitter page.
require_once(\'TwitterAPIExchange.php\');
$
It was much easier than I thought, I just used the $_FILES to store the image in a variable so I could use it in the $postfields array.
$url_media = "https://api.twitter.com/1.1/statuses/update_with_media.json";
$requestMethod = "POST";
$tweetmsg = $_POST['post_description'];
$twimg = $_FILES['pictureFile']['tmp_name'];
$postfields = array(
'status' => $tweetmsg,
'media[]' => '@' . $twimg
);
try {
$twitter = new TwitterAPIExchange($settings);
$twitter->buildOauth($url_media, $requestMethod)
->setPostfields($postfields)
->performRequest();
echo "You just tweeted with an image";
} catch (Exception $ex) {
echo $ex->getMessage();
}