From dc3ec3556046aa804d0224bb54dd27ab6001e449 Mon Sep 17 00:00:00 2001 From: Reinhart Previano Koentjoro Date: Wed, 13 Jul 2022 06:41:24 +0700 Subject: [PATCH] invoke-webrequest: add page (#8177) * windows/get-*: Add PowerShell-only notice * Update pages/windows/get-childitem.md Co-authored-by: Axel Navarro * windows/get-*: Change PowerShell notice Co-authored-by: Axel Navarro * invoke-item: Add command * invoke-item: Remove quotations whenever possible * invoke-item: Put all asterisk globs inside parameters * invoke-item: More asterisk inside parameters * Update pages/windows/invoke-item.md Co-authored-by: Axel Navarro * Update pages/windows/invoke-item.md * invoke-webrequest: Add page with related aliases * invoke-webrequest: Use LF instead of CRLF * fix: Use -p parameter instead Co-authored-by: Axel Navarro --- pages/windows/curl.md | 15 +++++++++++++++ pages/windows/invoke-webrequest.md | 25 +++++++++++++++++++++++++ pages/windows/iwr.md | 7 +++++++ pages/windows/wget.md | 15 +++++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 pages/windows/curl.md create mode 100644 pages/windows/invoke-webrequest.md create mode 100644 pages/windows/iwr.md create mode 100644 pages/windows/wget.md diff --git a/pages/windows/curl.md b/pages/windows/curl.md new file mode 100644 index 0000000000..43b14461da --- /dev/null +++ b/pages/windows/curl.md @@ -0,0 +1,15 @@ +# curl + +> In PowerShell, this command may be an alias of `Invoke-WebRequest` when the original `curl` program () is not properly installed. + +- Check whether `curl` is properly installed by printing its version number. If this command evaluates into an error, PowerShell may have substituted this command with `Invoke-WebRequest`: + +`curl --version` + +- View documentation for the original `curl` command: + +`tldr curl -p common` + +- View documentation for PowerShell's `Invoke-WebRequest` command: + +`tldr invoke-webrequest` diff --git a/pages/windows/invoke-webrequest.md b/pages/windows/invoke-webrequest.md new file mode 100644 index 0000000000..4c53c08ffb --- /dev/null +++ b/pages/windows/invoke-webrequest.md @@ -0,0 +1,25 @@ +# Invoke-WebRequest + +> Performs a HTTP/HTTPS request to the Web. +> This command can only be used through PowerShell. +> More information: . + +- Download the contents of a URL to a file: + +`Invoke-WebRequest {{http://example.com}} -OutFile {{filename}}` + +- Send form-encoded data (POST request of type `application/x-www-form-urlencoded`): + +`Invoke-WebRequest -Method Post -Body @{ name='bob' } {{http://example.com/form}}` + +- Send a request with an extra header, using a custom HTTP method: + +`Invoke-WebRequest -Headers {{@{ X-My-Header = '123' }}} -Method {{PUT}} {{http://example.com}}` + +- Send data in JSON format, specifying the appropriate content-type header: + +`Invoke-WebRequest -Body {{'{"name":"bob"}'}} -ContentType 'application/json' {{http://example.com/users/1234}}` + +- Pass a username and password for server authentication: + +`Invoke-WebRequest -Headers @{ Authorization = "Basic "+ [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("myusername:mypassword")) } {{http://example.com}}` diff --git a/pages/windows/iwr.md b/pages/windows/iwr.md new file mode 100644 index 0000000000..5a008a7e45 --- /dev/null +++ b/pages/windows/iwr.md @@ -0,0 +1,7 @@ +# iwr + +> This command is an alias of `Invoke-WebRequest` in PowerShell. + +- View documentation for the original command: + +`tldr invoke-webrequest` diff --git a/pages/windows/wget.md b/pages/windows/wget.md new file mode 100644 index 0000000000..3dd8b0367c --- /dev/null +++ b/pages/windows/wget.md @@ -0,0 +1,15 @@ +# wget + +> In PowerShell, this command may be an alias of `Invoke-WebRequest` when the original `wget` program () is not properly installed. + +- Check whether `wget` is properly installed by printing its version number. If this command evaluates into an error, PowerShell may have substituted this command with `Invoke-WebRequest`: + +`curl --version` + +- View documentation for the original `wget` command: + +`tldr wget -p common` + +- View documentation for PowerShell's `Invoke-WebRequest` command: + +`tldr invoke-webrequest`