Jump to content
pzenz

Curl String in AutoIT

Recommended Posts

pzenz

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

Share this post


Link to post
Share on other sites
jdelaney

Wrap the whole thing in single quotes. You can still use curl.  As always, submit what you have tried, and someone will correct it.


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
pzenz

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

Share this post


Link to post
Share on other sites
pzenz

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)

 

Share this post


Link to post
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

×