[Header]
ブログやホームページを更新した際、広報としてTwitterへ投稿したいなーと思いまして、PHPを使ってTwitterへ投稿する方法など、少しまとめてみました。今回は、Twitterアプリケーション作成の準備について書きたいと思います。
![](https://d-hanamaru.fun/wp-content/uploads/2020/01/twitter1-512x490-1-300x287.png)
はじめに
PHPでTwitterの投稿やツィートを取得するプログラムを作成する為には、事前にTwitterの開発者向けサイトにて「Consumer key」「Consumer secret」「Access token」「Access token secret」の取得が必要です。以下サイトからアプリケーション登録がおこなえます。
Twitter Application Management
アプリケーション新規作成
Twitter Application Management (Twitterアカウントでログインする必要があります。)の画面右上にあるボタン「Create New App」を押下します。
![](https://d-hanamaru.fun/wp-content/uploads/2020/01/Screenshot-from-2017-04-28-19-46-44.jpg)
「Create an application」 画面に遷移しますので、以下項目に入力
- Name:アプリケーションの名前(日本語でOK)
- Description:アプリケーションの説明(日本語でOK)
- Website:自分のサイト等のURLを入力
- Callback URL:特に入力必須ではないです。
入力が完了したら、
チェックボックス「Yes, I have read and agree to the Twitter Developer Agreement.」にチェックを入れ、ボタン「Create your Twitter application」を押下します。
Consumer Key(API Key)とConsumer Secret (API Secret)の取得
![](https://d-hanamaru.fun/wp-content/uploads/2020/01/Screenshot-from-2017-04-28-20-05-22.png)
「manage keys and access tokens」をクリックします。
![](https://d-hanamaru.fun/wp-content/uploads/2020/01/Screenshot-from-2017-04-28-20-10-37.png)
「Consumer Key (API Key)」と「Consumer Secret (API Secret)」を控えておきます。
Access Token と Access Token Secret の取得
画面下に移動し「Your Access Token」のボタン「Create my access token」を押下。
![](https://d-hanamaru.fun/wp-content/uploads/2020/01/Screenshot-from-2017-04-28-20-18-06.png)
「Access Token」と「Access Token Secret」を控えておきます。
まとめ
- Consumer Key (API Key)
- Consumer Secret (API Secret)
- Access Token
- Access Token Secret
以上、4項目をアプリケーションを作成する際使用しますので、控えておきます。
これで、アプリケーション作成準備が整いました。
[A8_TechAcademy065]
[Footer]