TwitterOAuth Tweet Text+Media

oauth
media-upload
php

#1

Hey, im using TwitterOAuth API but when im posting a tweet with text and media im getting this error:
Fatal error: Call to undefined method TwitterOAuth::upload() in …
Here’s my code :


  
include '../tweet/TwitterOAuth.php';
# Create the connection
$twitter = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);
# Migrate over to SSL/TLS

$twitter->ssl_verifypeer = true;
$media1 = $twitter->upload('media/upload', ['media' => 'img.jpg']);
$message= "Whatever";
$parameters = [
    'status' => $message ,
	
    'media_ids' => implode(',', [$media1->media_id_string]),
];

$result = $twitter->post('statuses/update', $parameters);

#2

It looks like you need to update TwitterOAuth.


#3

Im using the latest version from here https://github.com/abraham/twitteroauth


#4

Oh my bad i was actually using an old version lol
Thanks