Search
cURL-PowerShell

Use cURL in PowerShell

Use cURL in PowerShell

What’s that? cURL in PowerShell? What are you doing he-you’re just Invoke-WebRequest aren’t you?

Imposter is revealed to be Invoke-WebRequest all along!

Yep! You can kind of use cURL commands in Windows Powershell. This “cURL” is actually just an alias of Invoke-WebRequest.

Get-Command curl

Which will return:

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Alias           curl -> Invoke-WebRequest                                            

Very sneaky PowerShell. You can use curl instead of entering Invoke-WebRequest and still use the same parameters of Invoke-WebRequest (ie. -Uri, -Body, -Method). This also means you can’t use the parameters of the actual cURL (ie. -X, -H, -d). With that in mind, you can do something that looks like a cURL GET request:

curl "https://reqbin.com/echo"

and get back:

StatusCode        : 200
StatusDescription : OK
Content           : <html><head><title>ReqBin Echo</title><meta name="description" content="ReqBin Echo Interface"><meta 
                    charset="utf-8"><meta name="viewport" content="width=device-width"><link rel="shortcut icon" href="...
RawContent        : HTTP/1.1 200 OK
                    Transfer-Encoding: chunked
                    Connection: keep-alive
                    Access-Control-Allow-Origin: *
                    CF-Cache-Status: HIT
                    Age: 6732
                    Expect-CT: max-age=604800, report-uri="https://report-uri.cloudfla...
Forms             : {}
Headers           : {[Transfer-Encoding, chunked], [Connection, keep-alive], [Access-Control-Allow-Origin, *], [CF-Cache-Status, HIT]...}
Images            : {}
InputFields       : {}
Links             : {}
ParsedHtml        : mshtml.HTMLDocumentClass
RawContentLength  : 643

Pretty neat!

Share the Post:

Related Posts

PNG Press – Convert all those annoying .webp files quickly

PNG Press is a lightweight desktop application built using .NET Core 8. It features a simple drag-and-drop interface designed to convert one or multiple images to PNG format with ease. This project was born out of my own necessity for a straightforward image conversion tool, and I’m excited to finally share it with you.

Read More

Yu-Gi-Oh! Rarity Collection 2 Set Overview

The Yu-Gi-Oh! TCG set Rarity Collection 2 is getting mixed reviews to say the least. I’ve consulted with the Millennium items and searched the labyrinth of Atem’s mind to find this Yu-Gi-Oh! set’s stats, metrics, and other neat insights, let’s go!

Read More