Jump to content

API http get request problem - curl/winhttp


Recommended Posts

Hello friends, i have a working curl command that show informations about my account on binance.com, but_it dont work with autoit code without curl.exe.
I want to do it without curl, because the whole process much Slower_ with StdoutRead (I want get the response in variable.)

My Curl command in Autoit:
This 2 are works, but_ i would like to do it without curl.exe

$apikey="XYZ"
sCommand = @ScriptDir & '\curl.exe -k -H "X-MBX-APIKEY: ' & $apikey & '" -X GET "https://api.binance.com/api/v3/account?' &  $request

the same in .bat  file

curl.exe -k -H "X-MBX-APIKEY: XYZ" -X GET "https://api.binance.com/api/v3/account?timestamp=1514917812000&signature=85bdee77e53cd521e1d5229fbfb459d53799c42b3fa4596d73f1520fad5f965a"

(I use curl with -k option which allows curl to make insecure connections, because there is problem with the sites certificate, (cURL error 60))

 

I tried many variations, this is the latest... I cant get the same response.
curl $error message (I changed ): {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}
autoit version $error message (Response code:400): Mandatory parameter 'timestamp' was not sent, was empty/null, or malformed.

 

$request = $query & '&signature=' & $signature
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", "https://api.binance.com/api/v3/account", False)
$oHTTP.SetRequestHeader("X-MBX-APIKEY", $apikey)
$oHTTP.Send($request)
$oReceived = $oHTTP.ResponseText
$oStatusCode = $oHTTP.Status
If $oStatusCode <> 200 then
 MsgBox(4096, "Response code", $oStatusCode)
EndIf

 

thanks

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...