Jump to content
Sign in to follow this  

https with self-signed cert

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")

    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)^ ERROR
->02:27:30 AutoIt3.exe ended.rc:1
>Exit code: 1    Time: 0.709



Edited by botanic

Share this post

Link to post
Share on other sites

Its specifically an issue with self-signed certs, http works as well as https to a non-self-signed url

I have found a few things but nothing that helped :

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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.