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);