더북(TheBook)

D.2.2 –L 옵션을 이용한 redirect 따라가기

앞에서 우리가 조회한 google.com 페이지에서는 302 에러 코드를 리턴했습니다. 여기서 302는 리디렉션(redirection) 코드를 의미합니다. 다른 페이지로 이동하는 페이지란 의미입니다. -L 옵션을 이용해 리디렉션되는 페이지를 따라가 보겠습니다. curl –L www.google.com을 입력합니다.

redirect 따라가기 : -L 옵션

D:\curl-7.56.1-win64-mingw\bin> curl -L www.google.com

<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="ko"><head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type">

<meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png"

itemprop="image"><title>Google</title><script>(function(){window.google={kEI:'Pc3tWdqMIYf-......


 

옵션을 붙이기 전과는 다르게 실제 콘텐츠 내용이 있는 페이지를 호출합니다.

신간 소식 구독하기
뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.