How do you redirect wget response to standard out?

I have a crontab that wgets a PHP page every five minutes (just to run some the PHP code), and I want to send the output of the request to standard out, while sending the normal wget output to /dev/null (or otherwise hide it). I couldn't find it in the wget manual.

I'm looking for something like:

wget -o stdout http://whatever.com/page.php > /dev/null

Anyone know?


Solution 1:

wget -O - http://whatever.com/page.php > /dev/null

or, if you want to redirect standard error output also:

wget -O - http://whatever.com/page.php > /dev/null 2>&1

or, for codegolf :-)

wget -O-

Solution 2:

A simpler version

wget -qO- http://example.com

equivalent to

wget -q -O - http://example.com

where

  • -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.