Last Updated: February 25, 2016
·
1.253K
· sendypw

Twitter API 1.1 update_with_media


$tmhOAuth = new tmhOAuth(array(
'consumerkey' => 'abc',
'consumer
secret' => 'abc',
'usertoken' => 'abc',
'user
secret' => 'abc',
));

$image = 'your image url';
$message = 'hello world';

$response = $tmhOAuth->request('POST', $tmhOAuth->url('1.1/statuses/updatewithmedia'),
array(
'status' => $message,
'media[]' => filegetcontents($image)
));

if ($response != 200) {
//Do something if the request was unsuccessful
}
</pre>