-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcURL_POST
More file actions
56 lines (45 loc) · 1.53 KB
/
Copy pathcURL_POST
File metadata and controls
56 lines (45 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
@echo off
title cURL POST Request Sender
color 0A
:loop
cls
echo ====================================================
echo cURL POST Request Sender
echo ====================================================
echo.
:: 변수 초기화
set "target_url="
set "header1="
set "header2="
set "post_data="
:: 사용자 입력 받기
set /p target_url="1. Target URL (예: http://example.com/api) : "
if "%target_url%"=="" goto loop
echo.
echo [헤더 입력란] - 생략하려면 그냥 엔터를 누르세요.
set /p header1="2. Header 1 (예: Content-Type: application/json) : "
set /p header2="3. Header 2 (예: Authorization: Bearer token) : "
echo.
set /p post_data="4. POST Data (예: {"key":"value"} 또는 a=1&b=2) : "
:: cURL 명령어 조합
set cmd=curl -k -X POST "%target_url%"
:: 헤더 값이 입력된 경우 명령어에 추가
if not "%header1%"=="" set cmd=%cmd% -H "%header1%"
if not "%header2%"=="" set cmd=%cmd% -H "%header2%"
:: 데이터가 입력된 경우 명령어에 추가
if not "%post_data%"=="" set cmd=%cmd% -d "%post_data%"
echo.
echo ====================================================
echo [전송 명령어 확인]
echo %cmd%
echo ====================================================
echo.
:: cURL 실행 (-i 옵션을 추가하면 응답 헤더도 함께 출력됩니다)
%cmd% -i
echo.
echo.
echo ====================================================
echo 요청이 완료되었습니다. 계속하려면 아무 키나 누르세요.
echo ====================================================
pause > nul
goto loop