WEB制作メモ

web制作・ビジネス・アイデア・生活・ホームページ制作・更新など

twitter apiを php で動かす

composer.json 
    {
    "require": {
        "abraham/twitteroauth": "0.7.2"
    }
}
composer update
アクセス
    https://apps.twitter.com/
https://apps.twitter.com/
You currently have Essential access which includes access to Twitter API v2 endpoints only. If you need access to this endpoint, you’ll need to apply for Elevated access via the Developer Portal. You can learn more here: https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api#v2-access-leve
が出てきてエラーになる

 

 

そもそも

abraham/twitteroauth を latestにした方がいいのか

 

composer require abraham/twitteroauth

 

返り値は null

 

動かない。

 

ver.2のTwitter API v2 endpoints にしろってことだとおもう。

 

もう一回 ディベロッパーへもどってみるか。。。

現在、Twitter API v2エンドポイントへのアクセスのみを含むEssentialアクセス権をお持ちです。このエンドポイントへのアクセスが必要な場合、開発者ポータルからElevatedアクセスに申請する必要があります。詳しくはこちらをご覧ください: https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api#v2-access-leve

 

Elevated 

 

んん?abraham/twitteroauthはv2に 対応してないのかな。

となると頼らずに、普通にとってくるしかない?

 

f:id:sabo333:20220311200049p:plain

Bearer Token

これは、つかっていなかった。。

labo.kon-ruri.co.jp

こちらを参考にすすめると あっさり取得できた!。