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- "somedomain.com/somefile.php?SomeParameter1=abc&SomeParameter2=23&SomeParameter3=0"

To show full connection information and errors too:

wget -O- "somedomain.com/somefile.php?SomeParameter1=abc&SomeParameter2=23&SomeParameter3=0"

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 – http://example.com” )

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

https://stackoverflow.com/questions/43662591/wget-using-timeout-and-tries-together/43664731

wget documentation

http://www.gnu.org/software/wget/manual/wget.html

USEFUL?
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.

Comments

Your email address will not be published.