Curl

wwiki
이동: 둘러보기, 검색

사용법[편집 | 원본 편집]

Usage: curl [options...] <url>

기본 옵션[편집 | 원본 편집]

-H, --header <header/@file> Pass custom header(s) to server. (ex: -H 'X-Naver-Client-Id: xxxx')

-v, --verbose Make the operation more talkative

-k, --insecure Allow insecure server connections when using SSL

-u, --user <user:password> Server user and password

--digest Use HTTP Digest Authentication

-T, --upload-file <file> Transfer local FILE to destination

-s, --silent Silent mode (에러 메시지 등이 보이지 않지만, output은 보이기 때문에 > /dev/null 출력을 전환해야 한다.)

-X, --request <method> Specify request method to use

-L, --location[편집 | 원본 편집]

(HTTP) If the server reports that the requested page has moved to a different location (indicated with a Location: header and a 3XX response code), this option will make curl redo the request on the new place.

-d, --data <data>[편집 | 원본 편집]

(HTTP MQTT) Sends the specified data in a POST request to the HTTP server, in the same way that a browser does when a user has filled in an HTML form and presses the submit button.

If you start the data with the letter @, the rest should be a file name to read the data from, or - if you want curl to read the data from stdin.

Examples:

 curl -d "name=curl" https://example.com
 curl -d "name=curl" -d "tool=cmdline" https://example.com
 curl -d @filename https://example.com

--data-binary <data>[편집 | 원본 편집]

(HTTP) This posts data exactly as specified with no extra processing whatsoever.


Example:

 curl --data-binary @filename https://example.com

예시[편집 | 원본 편집]

Post[편집 | 원본 편집]

json[편집 | 원본 편집]

$ curl --data '{"key":"value", "key2":"value2"}' --header "Content-Type: application/json" --request POST http://localhost/api

외부링크[편집 | 원본 편집]

https://curl.se/