Getting The Output Of A GET request On The Command Line

(You need to put the URL and parameters inside “” if using more than 1 parameter)

wget -qO- ""

To show full connection information and errors too:

wget -O- ""

Options used:

-q turns off the output of log, including error information.
-O -, equivlalent to -O /dev/stdout, means dump the web page to a file named /dev/stdout.

( “-qO-” is same as using “wget -q -O –” )

Use a timeout!!!!

The default wget timeout is 900 seconds. If you are using wget in an application and will retry then make sure you specify a timeout to avoid the possibility of multiple wgets being called on top of each other

–tries Number of retires, default 20. Useful if downloading large files etc if connection requires reattempts to finish the download

–timeout Timeout in seconds

wget -qO- --tries=1 --timeout=60 "http:\\something"
–tries and –timeout used together

wget documentation

We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.


Your email address will not be published. Required fields are marked *