【TwitterAPI】エラー「Read-only application cannot POST.」の対処法
TwitterAPIの「update.json」を使って私のTwitterにツイートしようとした時、次のようなエラーがでました。
Array
(
[request] => /1.1/statuses/update.json
[error] => Read-only application cannot POST.
)
ここではこのエラーの対処法を説明しています。
Java、PHP、javascriptなどのプログラミング&Wordpress、HTML、CSSなどのWeb情報ブログ(最近は雑記や仮想通貨のことなど幅広く)
TwitterAPIの「update.json」を使って私のTwitterにツイートしようとした時、次のようなエラーがでました。
Array
(
[request] => /1.1/statuses/update.json
[error] => Read-only application cannot POST.
)
ここではこのエラーの対処法を説明しています。
file_get_contents関数で任意の画像のファイルデータを取得し、そのデータをfile_put_contents関数に渡してサーバー内に画像を保存するプログラムを実行したのですが、保存した画像をブラウザで確認したところ
画像ファイル"http://~~~"は壊れているため、表示できませんでした
というエラーが出て困ってしまいました。
ここでは「なぜ画像が壊れるのか?」に対処した流れを書いておきたいと思います。
先ほどこれまで放置していたサーバーのPHPバージョンを5.2から5.4に変更したところ、これまで問題なく動いていたプログラムで
Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.
というエラーが出ました。
今回この対処を行ったのでメモしておきます。
file_get_contents関数は手軽に外部にあるデータを取得できますが、外部の環境に依存するためエラー処理をしっかり記述しておく必要があります。
ここではfile_get_contents関数を使うときの詳細なエラー処理について説明しています。
続きを読む