Redirecting wget to stdout

No Comments

Sometimes you need the data wget retrieves written to the STDOUT, usually for further processing, instead of into a file. This is easily achieved with the following call:

$ wget -O - http://my/url/

The '-' (minus character) does indeed redirect all written data to the STDOUT. In my case this was required as a fallback for a simple cURL / file_get_contents() wrapper function. So if anything else fails - if shell_exec + wget are available, you still are able to retrieve data from remote locations, ie. URLs ;)


Be the first to write a comment!