Call to undefined method setApiVersion()
HackerGaucho opened this issue · 1 comments
HackerGaucho commented
What are you attempting to do
I am trying to use API v2
Expected behavior
Using the API V2
Actual behavior
The error message below:
PHP Fatal error: Uncaught Error: Call to undefined method Abraham\TwitterOAuth\TwitterOAuth::setApiVersion()
Code example
<?php
require 'vendor/autoload.php';
use Abraham\TwitterOAuth\TwitterOAuth;
$connection = new TwitterOAuth(
TWITTER_CONSUMER_KEY,
TWITTER_CONSUMER_SECRET,
TWITTER_ACCESS_TOKEN,
TWITTER_ACCESS_TOKEN_SECRET
);
$connection->setApiVersion('2');
$response = $connection->post("statuses/update", ["status" => "hello world"]);
Versions:
- TwitterOAuth: v2.0.0
- PHP: v8.1.9
Additional context
API V2 with "Elevated access" (Higher levels of access to the Twitter API)
abraham commented
You need to update TwitterOAuth. https://github.com/abraham/twitteroauth/releases/tag/3.0.0