abraham/twitteroauth

500 error for TwitterOAuth

myinnos opened this issue · 4 comments

Receiving 500 error

Code

    require_once('twitteroauth/autoload.php');
    use Abraham\TwitterOAuth\TwitterOAuth;
    $connection = new TwitterOAuth($ck, $cs, $ot, $os);
    $data =  [
        'text' => 'Hello world'
        ];
    $connection->setApiVersion('2');
    $content = $connection->post("tweets", $data, true);
    echo json_encode($content);

Versions:

  • TwitterOAuth: v 6.1.0
  • PHP: v 7.3.33

It is failing while $connection to TwitterOAuth and has no issue with Twitter keys.

I'm not affiliated with this code base, but I think v6.x requires PHP 8 or later. That may have something to do with it.

Is the 500 error from Twitter or from your server code? Is the error message?

@abraham it's from server code.

Look at your server logs to see what's causing the 500s. @rbaines comment about PHP version is a likely cause.