'curl', when using Windows PowerShell is an alias for Invoke-WebRequst and that real curl.
Get-Alias -Name curl |
Format-Table -AutoSize
# Results
<#
CommandType Name Version Source
----------- ---- ------- ------
Alias curl -> Invoke-WebRequest
#>
Get-Alias -Definition Invoke-WebRequest |
Format-Table -AutoSize
# Results
<#
CommandType Name Version Source
----------- ---- ------- ------
Alias curl -> Invoke-WebRequest
Alias iwr -> Invoke-WebRequest
Alias wget -> Invoke-WebRequest
#>
# Get specifics for a module, cmdlet, or function
(Get-Command -Name Invoke-WebRequest).Parameters
(Get-Command -Name Invoke-WebRequest).Parameters.Keys
Get-help -Name Invoke-WebRequest -Examples
# Results
<#
$R = Invoke-WebRequest -URI http://www.bing.com?q=how+many+feet+in+a+mile
$R.AllElements | where {$_.innerhtml -like "*=*"} | Sort { $_.InnerHtml.Length } | Select InnerText -First 5
the shortest HTML value often helps you find the most specific element that matches that text.
$R=Invoke-WebRequest http://www.facebook.com/login.php -SessionVariable fb
$FB
$Form = $R.Forms[0]
$Form | Format-List
$Form.fields
$Form.Fields["email"]="[email protected]"
$R=Invoke-WebRequest -Uri ("https://www.facebook.com" + $Form.Action) -WebSession $FB -Method POST -Body $Form.Fields
# Sends a sign-in request by running the Invoke-WebRequest cmdlet. The command specifies a value of "fb" for the SessionVariable parameter, and saves
$R.StatusDescription
(Invoke-WebRequest -Uri "http://msdn.microsoft.com/en-us/library/aa973757(v=vs.85).aspx").Links.Href
#>
Get-help -Name Invoke-WebRequest -Full
Get-help -Name Invoke-WebRequest -Online
To use real curl in PowerShell, because of Command precedence ...
about_Command_Precedence
... you have to use curl.exe and or the full UNC to curl.exe.
If you do not specify a path, PowerShell uses the following precedence
order when it runs commands for all items loaded in the current
session:
1 - Alias
2 - Function
3 - Cmdlet
4 - External executable files
(programs and non-PowerShell scripts)
FYI...
Also due to industry at-large change for SSL sites, this must be in your code:
# Required for use with web SSL sites
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12