twitter api を使って、ダイレクトメッセージを送るphpのプロクラムを作っているのですが、「Sorry, that page does not exist」となって送信できません。
下記がプログラムです。
<?php //twitteroauthは最新のものをダウンロードしています include(TEMPLATEPATH .'/withnet/add_kanrigamen/test_2/twitteroauth/autoload.php'); use Abraham\TwitterOAuth\TwitterOAuth; //https://developer.twitter.com/en/appsでの登録でAccess permissionはRead, write, and Direct Messagesにしました。 $consumerKey = "xxxx"; $consumerSecret = "yyyy"; $accessToken = "zzzz"; $accessTokenSecret = "aaaa"; $connection = new TwitterOAuth($consumerKey,$consumerSecret,$accessToken,$accessTokenSecret); $connection->post('direct_messages/events/new.json', [ 'event' => [ 'type' => 'message_create', 'message_create' => [ 'target' => [ 'recipient_id' => 12**34**56 ], 'message_data' => [ 'text' => 'test' ] ] ] ], true); print_r($connection->getLastBody()); recipient_id' => 12**34**56は実際に存在するものですので、apiにキチンと届いていないので冒頭のようなエラーになっているのではと考えています。どのように訂正すればいいのでしょうか? よろしくお願いいたします。回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。