Last Updated: February 25, 2016
·
1.47K
· 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>

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Related Tags
#php
#twitter
Did you know?

PHP applications still send a browser full of JavaScript. Hardening the server does not inventory the payment, analytics, and plugin scripts that run after the HTML is delivered.

Security insights from Cside