

When a requested web page is moved to another place, then an HTTP Location header will be sent as a Response and it will have where the actual web page is located.įor example, when someone types in the browser from India, it will be automatically redirected to ‘.in’. Follow HTTP Location Headers with -L optionīy default CURL doesn’t follow the HTTP Location headers.

Please note that when we download multiple files from a same sever as shown above, curl will try to re-use the connection. The below command will download both index.html and gettext.html and save it in the same name under the current directory. We can download multiple files in a single shot by specifying the URLs on the command line. Refer to wget examples to understand how to use wget effectively.

Similar to cURL, you can also use wget to download files. We can use ‘>’|’-o’|’-O’ options to move the result to a file. Note: When curl has to write the data to the terminal, it disables the Progress Meter, to avoid confusion in printing. When you use curl -O (uppercase O), it will save the content in the file named ‘gettext.html’ itself in the local machine. Now the page gettext.html will be saved in the file named ‘mygettext.html’.
