"Curl"의 두 판 사이의 차이
(같은 사용자의 중간 판 9개는 보이지 않습니다) | |||
1번째 줄: | 1번째 줄: | ||
− | == 옵션 == | + | == 사용법 == |
+ | Usage: curl [options...] <url> | ||
+ | |||
+ | === 기본 옵션 === | ||
-H, --header <header/@file> Pass custom header(s) to server. (ex: -H 'X-Naver-Client-Id: xxxx') | -H, --header <header/@file> Pass custom header(s) to server. (ex: -H 'X-Naver-Client-Id: xxxx') | ||
5번째 줄: | 8번째 줄: | ||
-k, --insecure Allow insecure server connections when using SSL | -k, --insecure Allow insecure server connections when using SSL | ||
+ | |||
+ | -u, --user <user:password> Server user and password | ||
--digest Use [[HTTP Digest Authentication]] | --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 <nowiki><data></nowiki> === | ||
+ | (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" <nowiki>https://example.com</nowiki> | ||
+ | curl -d "name=curl" -d "tool=cmdline" <nowiki>https://example.com</nowiki> | ||
+ | curl -d @filename <nowiki>https://example.com</nowiki> | ||
+ | |||
+ | === --data-binary <nowiki><data></nowiki> === | ||
+ | (HTTP) This posts data exactly as specified with no extra processing whatsoever. | ||
+ | |||
+ | |||
+ | Example: | ||
+ | curl --data-binary @filename <nowiki>https://example.com</nowiki> | ||
+ | |||
+ | == 예시 == | ||
+ | |||
+ | === Post === | ||
+ | |||
+ | ==== json ==== | ||
+ | $ curl --data '{"key":"value", "key2":"value2"}' --header "Content-Type: application/json" --request POST <nowiki>http://localhost/api</nowiki> | ||
+ | |||
+ | == 외부링크 == | ||
+ | https://curl.se/ | ||
+ | |||
+ | ㅇ | ||
+ | [[분류:명령어]] |
2023년 4월 20일 (목) 00:29 기준 최신판
목차
사용법[편집 | 원본 편집]
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
외부링크[편집 | 원본 편집]
ㅇ