본문 바로가기
infra

리눅스에서 POST, GET 다른 서버로 요청하기

by chunkind 2018. 9. 7.
반응형

curl 설치

Linux나 Mac OS X 에는 기본 탑재되어 있으나 Windows는 build 된 바이너리를 설치해도 되고 compiler 가 있다면 소스를 받아서 직접 빌드해야된다.

아래 링크에서 받아서 설치
https://winampplugins.co.uk/curl/

 

사용법

curl -X POST --header 'Content-Type' --header 'Accept' -d '보낼내용' '보낼곳 url'

예시

curl -X POST --header 'Content-Type: application/xml' --header 'Accept: application/xml' -d '<?xml version="1.0"?> \
 <Request> \
   <API_CERT_KEY_VAL>string</API_CERT_KEY_VAL> \
   <INFO> \
     <PIN_NO>string</PIN_NO > \
     <STAT_CD>string</STAT_CD> \
     <PROC_DTIME>string</PROC_DTIME> \
   </INFO> \
   <MEMO>string</MEMO> \
 </Request> \
 ' 'http://localhost:8001/api/test'
반응형