abraham / twitteroauth

The most popular PHP library for use with the Twitter OAuth REST API.
https://twitteroauth.com
MIT License
4.3k stars 1.71k forks source link

500 error for TwitterOAuth #1200

Closed myinnos closed 11 months ago

myinnos commented 1 year ago

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:

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

rbaines commented 1 year ago

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.

abraham commented 1 year ago

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

myinnos commented 1 year ago

@abraham it's from server code.

abraham commented 1 year ago

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