Jump to content

Curl String in AutoIT


 Share

Recommended Posts

Hi guys,

please help me.

I´ll drive crazy otherwise.

 

I try to send a http PUT string if a button was pressed.

It works with the curl.exe but i dont know how to port it to the autoit tools.

 

Here´s the string i want to send.

 

"curl.exe" -u integrator:integrator --basic -k -i -X  PUT https://<IPADRESS>:4001/v1.0/Configuration/RestartSystem --data "value=True"

 

 

Please help me, how could i do this?

Thanks a lot

Regards 
Philipp

Link to comment
Share on other sites

Hi,

here are my first steps.

I tried to do this with WinHttp, seems to be the better sollution for this.

With WinHttp.au3:

Global $hOpen = _WinHttpOpen()

Global $hConnect = _WinHttpConnect($hOpen, "https://10.191.7.23")

;Global $hRequestSSL = _WinHttpSimpleSendSSLRequest($hConnect, "-u integrator:integrator --basic https://10.191.7.23:4001/v1.0/Configuration/RestartSystem -k -i -X", "PUT", "--data", "Value=True")

Global $hRequestSSL = _WinHttpSimpleSendRequest($hConnect, '-u integrator:integrator --basic https://10.191.7.23:4100/v1.0/Configuration/RestartSystem -k -i -X, "PUT", --data "Value=True"')

_WinHttpCloseHandle($hRequestSSL)
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)

 

With the normal curl.exe

$Username = "integrator"
$Password = "integrator"
$Http = "https://10.191.7.23:4001/v1.0/Configuration/RestartSystem"
$Command = 'curl.exe -u ' & $Username & ":" & $Password & ' --basic -k -i -X PUT ' & $Http & ' --data "value=True" '

 

Glad to here from you guys..

 

Thank you verry much

Philipp

Link to comment
Share on other sites

Here another try..

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1");$oHTTP.SetProxy(0) ;No Proxy
$user = "integrator"
$password = "integrator"
$url = "https://10.191.7.23:4001/v1.0/Configuration/RestartSystem"


$sGet = $user & ":" & $password & "--basic -k -i- X" & $url & "--data" & "?value=True"
$oHTTP.Open("PUT", $sGet, False) ;Post request
$oHTTP.Send() ; Send PUT request
$RESULT = $oHTTP.ResponseText ;
MsgBox(0, "Sent Message", $sReturn)

 

Link to comment
Share on other sites

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...