22external help file : Microsoft.PowerShell.Commands.Utility.dll-Help.xml
33Locale : en-US
44Module Name : Microsoft.PowerShell.Utility
5- ms.date : 01/03 /2024
5+ ms.date : 01/25 /2024
66online version : https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-5.1&WT.mc_id=ps-gethelp
77schema : 2.0.0
88title : Invoke-WebRequest
@@ -16,12 +16,13 @@ Gets content from a web page on the internet.
1616## SYNTAX
1717
1818```
19- Invoke-WebRequest [-UseBasicParsing] [-Uri] <Uri> [-WebSession <WebRequestSession>] [-SessionVariable <String>]
20- [-Credential <PSCredential>] [-UseDefaultCredentials] [-CertificateThumbprint <String>]
21- [-Certificate <X509Certificate>] [-UserAgent <String>] [-DisableKeepAlive] [-TimeoutSec <Int32>]
22- [-Headers <IDictionary>] [-MaximumRedirection <Int32>] [-Method <WebRequestMethod>] [-Proxy <Uri>]
23- [-ProxyCredential <PSCredential>] [-ProxyUseDefaultCredentials] [-Body <Object>] [-ContentType <String>]
24- [-TransferEncoding <String>] [-InFile <String>] [-OutFile <String>] [-PassThru] [<CommonParameters>]
19+ Invoke-WebRequest [-UseBasicParsing] [-Uri] <Uri> [-WebSession <WebRequestSession>]
20+ [-SessionVariable <String>] [-Credential <PSCredential>] [-UseDefaultCredentials]
21+ [-CertificateThumbprint <String>] [-Certificate <X509Certificate>] [-UserAgent <String>]
22+ [-DisableKeepAlive] [-TimeoutSec <Int32>] [-Headers <IDictionary>] [-MaximumRedirection <Int32>]
23+ [-Method <WebRequestMethod>] [-Proxy <Uri>] [-ProxyCredential <PSCredential>]
24+ [-ProxyUseDefaultCredentials] [-Body <Object>] [-ContentType <String>] [-TransferEncoding <String>]
25+ [-InFile <String>] [-OutFile <String>] [-PassThru] [<CommonParameters>]
2526```
2627
2728## DESCRIPTION
@@ -49,10 +50,10 @@ This cmdlet was introduced in Windows PowerShell 3.0.
4950This example uses the ` Invoke-WebRequest ` cmdlet to send a web request to the Bing.com site.
5051
5152``` powershell
52- $Response = Invoke-WebRequest -URI https://www.bing.com?q=how+many+feet+in+a+mile
53- $Response.AllElements | Where-Object {
54- $_. name -like "* Value" -and $_.tagName -eq "INPUT"
55- } | Select-Object Name, Value
53+ $Response = Invoke-WebRequest -UseBasicParsing - URI https://www.bing.com?q=how+many+feet+in+a+mile
54+ $Response.InputFields |
55+ Where-Object name -like "* Value" |
56+ Select-Object name, value
5657```
5758
5859``` Output
@@ -62,11 +63,10 @@ From Value 1
6263To Value 5280
6364```
6465
65- The first command issues the request and saves the response in the ` $Response ` variable.
66-
67- The second command filters the objects in the ** AllElements** property where the ** name** property
68- is like "* Value" and the ** tagName** is "INPUT". The filtered results are piped to ` Select-Object `
69- to select the ** name** and ** value** properties.
66+ The data returned by ` Invoke-WebRequest ` is stored in the ` $Response ` variable. The ** InputFields**
67+ property of the response contains the form fields. ` Where-Object ` is used to filter the form fields
68+ to those where the ** name** property is like "* Value". The filtered results are piped to
69+ ` Select-Object ` to select the ** name** and ** value** properties.
7070
7171### Example 2: Use a stateful web service
7272
0 commit comments