LoginSignup
9
7

More than 5 years have passed since last update.

こんな時はこうやってcurlする

Posted at

基本的な使い方メモ

cookieを保存したい

curl -c cookieを保存するファイル名 url

保存したcookieを使いたい

curl -b cookieを保存したファイル名 url

Request Headerを設定したい

curl -H 'name:value' url

-Hは複数指定可能
curl -H 'name:value' -H 'name:value' url

User Agentを変えたい

curl -H 'User-Agent:ユーザーエージェント' url

curl -A "ユーザーエージェント" url

Response bodyをファイルに保存したい

curl -o 保存ファイル名 url

Response bodyを表示したくない

/dev/nullを指定するとよい
curl -o /dev/null url

Response body保存の進捗を表示したくない

-s をつける
curl -o 保存ファイル名 -s url

9
7
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
9
7