As already mentioned by some commentators, you will see that curl is actually just an alias for Invoke-WebRequest :
PS> Get-Command curl CommandType Name Version Source ----------- ---- ------- ------ Alias curl -> Invoke-WebRequest
Note. I suggest using Get-Command rather than Get-Alias because you may not know if the command you are using is an alias, cmdlet or executable.
From now on, there are two possible ways to solve your problem:
Use PowerShell Invoke-RestMethod (or, if you use PowerShell <3, Invoke-WebRequest ):
Invoke-RestMethod -Uri http://localhost:18332/ -Credential bitcoinipvision -body $thisCanBeAPowerShellObject
As you can see, the content type is not required since JSON is the default IRM Type content; although you can change it using -ContentType .
If available in your current environment, use the original curl . You should enter it like this:
curl.exe --user bitcoinipvision --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "move", "params": ["acc-1", "acc-2", 6, 5, "happy birthday!"] }' -H 'content-type: application/json;' http://localhost:18332/
I would prefer the first option in the second, since PowerShell natively supports JSON responses, which allows you to easily use them, for example. by feeding it to Where-Object , Format-Table , Select-Object , Measure-Object and so much mure. If you prefer to use cUrl, you need to parse the string returned by curl.exe its own. It can also be problematic with binary content.
source share