Last active
August 29, 2015 14:24
-
-
Save ko31/f0ba9e0b9c8aeb5dce97 to your computer and use it in GitHub Desktop.
【PHP】TwitterOAuthからツイート投稿
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// TwitterOAuthライブラリ読み込み | |
require "twitteroauth/autoload.php"; | |
use Abraham\TwitterOAuth\TwitterOAuth; | |
// TwitterのAPIキー情報 | |
$consumerKey = "【コンシューマキー】"; | |
$consumerSecret = "【コンシューマシークレット】"; | |
$accessToken = "【アクセストークン】"; | |
$accessTokenSecret = "【アクセストークンシークレット】"; | |
// OAuth認証してAPI接続 | |
$connection = new TwitterOAuth($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret); | |
// ツイート投稿 | |
$message = "テストツイートです"; | |
$response = $connection->post("statuses/update", array("status" => $message)); | |
var_dump($response); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment