abraham / twitteroauth

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

When attempting an upload, get "Twitter REST API v1 is no longer active" error. #511

Closed justindlong closed 7 years ago

justindlong commented 7 years ago

Media1 stdClass Object ( [errors] => Array ( [0] => stdClass Object ( [message] => The Twitter REST API v1 is no longer active. Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview. [code] => 64 )

    )

)

PHP Code: echo "uploading media: ",$tRec['media'],"\n"; // it's got media, load the media, then post to twitter $media1 = $connection->upload('media/upload.json', ['media' => '/home/justinlo/public_html/tweet/graph/'.$tRec['media']]); $status = $connection->post("statuses/update", array( "status"=>$string, 'media_ids'=>$media1->media_id_string ) ); // post to twitter

I just re-downloaded the most current version of the twitteroauth library today.

agaleski commented 7 years ago

twitteroatuh uses version 1.1 of the TwitterApi already:

class TwitterOAuth extends Config
{
    const API_VERSION = '1.1';

... and Further in src/TwitterOAuth.php:

$url = sprintf('%s/%s/%s.json', $host, self::API_VERSION, $path);

How did you download / update it - via Composer or manually?

justindlong commented 7 years ago

actually, from the download link off Github. I'll try d/l from twitteroauth.com.

justindlong commented 7 years ago

I am using the latest version (0.7) downloaded from https://github.com/abraham/twitteroauth/releases, and still getting the same error.

justindlong commented 7 years ago

Scratch that. At some point I interjected "media/upload.json", and that's the problem. Sorry.

agaleski commented 7 years ago

;-) happens