hy30nq's blog

curl 주요 옵션 본문

Web/web dev

curl 주요 옵션

hy30nq 2024. 6. 14. 15:38
728x90

1. -X or --request : 사용할 HTTP 메서드 지정

curl -X POST http://example.com

 

2. -H or --header : HTTP 헤더를 추가

curl -H "Content-Type: application/json" http://example.com

 

3. -d or --data : POST 요청에 데이터를 담기

curl -d "param1=value1&param2=value2" http://example.com

 

4. --data-raw : POST 요청에 원시 데이터 담기

curl --data-raw "raw data" http://example.com

 

5. -F or --form : 멀티파트 폼 데이터 전송

curl -F "file=@/path/to/file" http://example.com/upload

 

6. -u or --user : Basic 인증을 위한 사용자 이름과 패스워드 지정

curl -u username:password http://example.com

 

7. -o or --output : 출력 결과를 파일에 저장

curl -o output.html http://example.com

 

8. -I or --head : 헤더 정보만을 출력

curl -I http://example.com

 

9. -v or --verdose : 요청과 응답 정보를 자세히 출력

curl -v http://example.com

 

10. --location or -L : 서버가 요청을 다른 위치로 리다이렉하면 따라감

curl -L http://example.com

 

11. --cookie : 쿠키를 전송

curl --cookie "name=value" http://example.com

 

12. --cookie-jar : 응답으로 받은 쿠키를 파일에 저장

curl --cookie-jar cookies.txt http://example.com

 

728x90