Jump to content

https with self-signed cert


botanic
 Share

Recommended Posts

I have been working on this for awile and I can get https to work with valid certs but not unsigned ones.

Here is my current code, I tried to set Option('WinHttpRequestOption_SslErrorIgnoreFlags' = 0x3300) but it didnt seem to do anything...

$file = FileOpen($configfile)
$data = FileRead($file)
HttpPost("https://" & $systemsettings[_ArraySearch($systemsettings, 'remoteserver')][1] & "/post.php", $data)

Func HttpPost($sURL, $sData = "")
    Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")

    $oHTTP.Open("POST", $sURL, False)
    If (@error) Then Return SetError(1, 0, 0)

    $oHTTP.Option('WinHttpRequestOption_SslErrorIgnoreFlags' = 0x3300)

    $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")

    $oHTTP.Send($sData)
    If (@error) Then Return SetError(2, 0, 0)

    If ($oHTTP.Status <> $HTTP_STATUS_OK) Then Return SetError(3, 0, 0)

    Return SetError(0, 0, $oHTTP.ResponseText)
EndFunc   ;==>HttpPost

here is the error im getting

C:developmentlib.au3 (92) : ==> The requested action with this object has failed.:
$oHTTP.Send($sData)
$oHTTP.Send($sData)^ ERROR
->02:27:30 AutoIt3.exe ended.rc:1
>Exit code: 1    Time: 0.709

 

 

Edited by botanic
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...