티스토리 뷰

공부

[Sh] curl request & response (status code)

승가비 2021. 5. 25. 22:23
728x90
#!/bin/bash

status_code=$(curl --write-out %{http_code} --silent --output -X GET /dev/null www.bbc.co.uk/news)

if [[ "$status_code" -ne 200 ]] ; then
  exit 1
else
  exit 0
fi

https://stackoverflow.com/questions/2220301/how-to-evaluate-http-response-codes-from-bash-shell-script

 

How to evaluate http response codes from bash/shell script?

I have the feeling that I'm missing the obvious, but have not succeeded with man [curl|wget] or google ("http" makes such a bad search term). I'm looking for a quick&dirty fix to one of our

stackoverflow.com

https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=wideeyed&logNo=221350638501 

 

cURL 소개, HTTP GET, POST 호출 방법

cURL이란? 다양한 프로토콜을 지원하는 데이터 전송용 Command Line Tool이다. (HTTP, HTTP...

blog.naver.com

 

728x90
댓글