LoginSignup
133
137

More than 5 years have passed since last update.

ログインが必要なページから curl でデータ取得

Last updated at Posted at 2012-12-26
 curl -c cookie.txt -d "user=kuboon" -d "pass=password" "http://example.com/login"
 curl -b cookie.txt "http://exapmle.com/admin/get_data"

1行目でログイン。デベロッパーツール等を用いて実際にログインするときのIDとパスワードのパラメータ名と form の POST 先 URL を調べ、-d オプションとURLを適当にして実行。ログインに成功したら、その時入手した cookie を cookie.txt に保存する。

2行目でデータ取得。さっき入手したばかりの cookie を手みやげにする

133
137
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
133
137