CMD - Curl


curl

  • データ転送用CMDツール
  • HTTP、HTTPS、FTP、FTPS、SFTP、IMAP、SMTP、POP 3など多くのプロトコルをサポートします.
  • ネットワーク要求
  • をデバッグするために使用される.
  • Linux、Mac、Windowsですべて使用可能
  • 1 Get HTTP Request

    curl https://www.naver.com/

    2 Get the HTTP response headers


    By default the response headers are hidden in the output of curl. To show them, use the i option:
    curl -i https://www.naver.com/
    # Header 만 출력 (no response body)
    curl -I https://www.naver.com/

    3 HTTP POST request


    The X option lets you change the HTTP method used. By default, GET is used, and it’s the same as writing
    # application/x-www-form-urlencoded Content-Type is sent.
    curl -d "option=value&something=anothervalue" -X POST https://www.naver.com/

    4 HTTP POST request sending JSON


    In this case you need to explicitly set the Content-Type header, by using the H option:
    curl -d '{"option": "value", "something": "anothervalue"}' -H "Content-Type: application/json" -X POST https://www.naver.com/

    ディスク上のJSONファイルを送信:

    curl -d "@my-file.json" -X POST https://www.naver.com/

    5 Store the response to a file

    curl -o sitefile.html https://www.naver.com/

    6要求と応答の詳細

    curl --verbose -I https://www.naver.com/

    7クロムツールの使用



    REF


    https://flaviocopes.com/http-curl/