Unlike curl
Invoke-WebRequest
command-line utility returns an object with various properties whose contents of the requested document are only one, you can get the contents in one statement by expanding the property as follows:
Invoke-WebRequest 'http://www.example.org/' | Select-Object -Expand Content
or by getting the value of a property through a dotted record as follows:
(Invoke-WebRequest 'http://www.example.org/').Content
Alternatively, you can use the Windows curl
port:
& curl.exe 'http://www.example.org/'
Call the program with the extension to distinguish it from the curl
alias for Invoke-WebRequest
.
source share