前提・実現したいこと
curlコマンドでtwitterにアクセスしようとしています。
以下を実施しました。(twitterへアクセスするツールは他にもありますが、今回はcurlコマンドの仕様確認の目的があり、curlコマンドでの認証を実施しようとしてます。)
1)$ curl https://twitter.com/login -c login.cookie -o result.html
2)$ cat result.html | grep authenticity_token
ここでキーを確認
3)$curl -X POST https://twitter.com/sessions \ -b login.cookie \ -c session.cookie \ -H "Content-type: application/x-www-form-urlencoded" \ --data-urlencode "authenticity_token=得られたauthenticity_token" \ --data-urlencode "session[username_or_email]=ユーザー名" \ --data-urlencode "session[password]=パスワード" \ -o result.html
発生している問題・エラーメッセージ
3のコマンドを実行すると以下のエラーメッセージが表示されました。
403 Forbidden: The server understood the request, but is refusing to fulfill it.curl: (6) Could not resolve host: result.html
認証に成功して情報を取得できると思っていたのですが、うまくいきませんでした。
何が問題と考えられるでしょうか?
試したこと
パスワードをデタラメなものにして入力しても同じメッセージでした。
403 Forbidden: The server understood the request, but is refusing to fulfill it.curl: (6) Could not resolve host: result.html
なお、vオプションを実施したら表示結果に以下がありました。
vオプションの表示結果で他にも確認箇所がありましたら、ご教示いただきたいです。
x-frame-options: DENY
補足情報(FW/ツールのバージョンなど)
macから実施しようとしています。また通常のWebブラウザでの認証は成功しています。
curlのバージョンです。
curl 7.63.0

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/03/14 22:13