Jump to content
trancexx

WinHTTP functions

Recommended Posts

I'm sorry for the JSON, I had 2 versions...

I initially used FileOpen/Read with _WinHttpOpenRequest, before using _WinHttpSimpleFormFill: I forgot to remove it in posting the code.

Now I rewrote the script with only  WinHttpSimpleFormFill: it works. Thank you.

 

Share this post


Link to post
Share on other sites

I'm using WinHTTP for get an XML from an internal network. If your question is "why you don't use InetGet" because on my machine is slow as hell instead your UDF require some MS for get the file in memory instead of the seconds of the internal function :D

The problem i have found is the lenght\size of the XML. If contain few information for fine. But if have many entry the XML is cutted and my script give me COM error for loading the XML. I think the problem is the buffer at default is 8192 but i don't know when-how to increase or if create problem and so on, i'm not expert in this for this reason i'm asking directly here

Thanks for the help, sorry if i can't give a working XML link.EDIT: Solved, just loop the request in a variable.

Edited by Terenz

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Share this post


Link to post
Share on other sites

Hi everyone.

Im trying to use this UDF to get a REST API working (for Qliksense). And in doing that i need to supply a client certificate in my webrequest and i was wondering if someone could help me withe some sample code to get me started?

Acording to this, it should be possible to use a certificate for from the local store. I would prefer using a .pem file or .pfx file if possible.

https://msdn.microsoft.com/en-us/library/windows/desktop/aa384076(v=vs.85).aspx?f=255&MSPPError=-2147217396

Here is an example in the documattion for the API:
https://help.qlik.com/en-US/sense-developer/2.2/Subsystems/RepositoryServiceAPI/Content/RepositoryServiceAPI/RepositoryServiceAPI-Example-Connect-DotNet-Certificates.htm

Any help would be appritiated.
This is the code i got so far:
 

$hopen = _WinHttpOpen("Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0")
$hconnect = _WinHttpConnect($hopen,"servername",4242)
$hRequest = _WinHttpOpenRequest($hconnect,"GET","/header_api/qrs/app/?Xrfkey=0123456789abcdef")
_WinHttpAddRequestHeaders($hRequest,"Content-Type: application/json")
_WinHttpAddRequestHeaders($hRequest,"x-qlik-xrfkey: 0123456789abcdef")
_WinHttpAddRequestHeaders($hRequest,"X-Qlik-User: UserDirectory=internal;UserId=sa_repository")
_WinHttpSendRequest($hRequest)
$svar = _WinHttpReceiveResponse($hRequest)
Local $Header = _WinHttpQueryHeaders($hRequest)
Local $Data = _WinHttpSimpleReadData($hRequest)
ConsoleWrite($Header & @CRLF)
ConsoleWrite($Data & @CRLF)

 

Share this post


Link to post
Share on other sites
On 16/11/2008 at 10:44 PM, trancexx said:

This is great! I think that we'll make something out of this :mellow:

 

About two functions...

Maybe just one, like this:

 

 

#include "WinHTTP.au3"


Global $hw_open = _WinHttpOpen()
If @error Then
    MsgBox(48, "Error", "Error initializing the usage of WinHTTP functions.")
    Exit
EndIf

Global $hw_connect = _WinHttpConnect($hw_open, "www.autoit.de")
If @error Then
    MsgBox(48, "Error", "Error specifying the initial target server of an HTTP request.")
    _WinHttpCloseHandle($hw_open)
    Exit
EndIf

Global $h_openRequest = _WinHttpOpenRequest($hw_connect)
If @error Then
    MsgBox(48, "Error", "Error creating an HTTP request handle.")
    _WinHttpCloseHandle($hw_connect)
    _WinHttpCloseHandle($hw_open)
    Exit
EndIf

_WinHttpSendRequest($h_openRequest)
If @error Then
    MsgBox(48, "Error", "Error sending the specified request.")
    _WinHttpCloseHandle($hw_connect)
    _WinHttpCloseHandle($hw_open)
    Exit
EndIf

_WinHttpReceiveResponse($h_openRequest)

If _WinHttpQueryDataAvailable($h_openRequest) Then
    Global $header = _WinHttpQueryHeaders($h_openRequest)
    ConsoleWrite($header & @CRLF & @CRLF)
    Global $chunk, $data, $extended
    While 1
        $chunk = X_WinHttpReadData($h_openRequest, 2)
        If Not @extended Then ExitLoop
        $data = _WinHttpBinaryConcat($data, $chunk)     
    WEnd
    ConsoleWrite(BinaryToString($data, 4) & @CRLF)
Else
    MsgBox(48, "Error", "Site is experiencing problems.")
EndIf

_WinHttpCloseHandle($h_openRequest)
_WinHttpCloseHandle($hw_connect)
_WinHttpCloseHandle($hw_open)


; #FUNCTION# ;===============================================================================
;
; Name...........: _WinHttpReadData
; Description ...: Reads data from a handle opened by the _WinHttpOpenRequest() function.
; Syntax.........: _WinHttpReadData($hRequest [, iMode [, $iNumberOfBytesToRead]])
; Parameters ....: $hRequest - Valid handle returned from a previous call to _WinHttpOpenRequest().
;                  $iMode - Integer representing reading mode. Default is 0 (charset is taken to be ANSI related).
;                  $iNumberOfBytesToRead - Integer value that contains the number of bytes to read. Default is 8192 bytes.
; Return values .: Success - Returns data read.
;                          - Sets @error to 0
;                  Failure - Returns empty string and sets @error:
;                  |1 - DllCall failed.
; Author ........: trancexx, ProgAndy
; Modified.......:
; Remarks .......: iMode can have these values:
;                  |0 - ANSI 
;                  |1 - UTF8
;                  |2 - Binary
; Related .......:
; Link ..........; http://msdn.microsoft.com/en-us/library/aa384104(VS.85).aspx
; Example .......; Yes
;
;==========================================================================================
Func X_WinHttpReadData($hRequest, $iMode = 0, $iNumberOfBytesToRead = 8192) 

    Local $lpBuffer
    
    Switch $iMode
        Case 0
            $lpBuffer = DllStructCreate("char[" & $iNumberOfBytesToRead & "]")
        Case 1, 2
            $lpBuffer = DllStructCreate("byte[" & $iNumberOfBytesToRead & "]")
    EndSwitch
    
    Local $a_iCall = DllCall("Winhttp.dll", "int", "WinHttpReadData", _
            "hwnd", $hRequest, _
            "ptr", DllStructGetPtr($lpBuffer), _
            "ulong", $iNumberOfBytesToRead, _
            "dword*", 0)

    If @error Or Not $a_iCall[0] Then
        SetError(1, 0, "")
    EndIf

    Switch $iMode
        Case 0
            Return SetError(0, $a_iCall[4], StringLeft(DllStructGetData($lpBuffer, 1), $a_iCall[4]))
        Case 1
            Return SetError(0, $a_iCall[4], BinaryToString(BinaryMid(DllStructGetData($lpBuffer, 1), 1, $a_iCall[4]), 4))
        Case 2
            Return SetError(0, $a_iCall[4], BinaryMid(DllStructGetData($lpBuffer, 1), 1, $a_iCall[4]))
    EndSwitch

EndFunc   

; #FUNCTION# ;===============================================================================
;
; Name...........: _WinHttpBinaryConcat
; Description ...: Concatenates two binary data returned by _WinHttpReadData() in binary mode.
; Syntax.........: _WinHttpBinaryConcat(ByRef $bBinary1, ByRef $bBinary2)
; Parameters ....: $bBinary1 - Binary data that is to be concatenated.
;                  $bBinary2 - Binary data to concat.
; Return values .: Success - Returns concatenated binary data.
;                          - Sets @error to 0
;                  Failure - Returns 0 and sets @error:
;                  |1 - Invalid input.
; Author ........: ProgAndy
; Modified.......: trancexx
; Remarks .......: 
; Related .......:
; Link ..........;
; Example .......; Yes
;
;==========================================================================================
Func _WinHttpBinaryConcat(ByRef $bBinary1, ByRef $bBinary2)
        
    Switch IsBinary($bBinary1) & IsBinary($bBinary2)
        Case 0
            Return SetError(1, 0, 0)
        Case 1
            Return SetError(0, 0, $bBinary2)
        Case 10
            Return SetError(0, 0, $bBinary1)
    EndSwitch           
    
    Local $iLen1 = BinaryLen($bBinary1)
    Local $iLen2 = BinaryLen($bBinary2)
    
    Local $struct = DllStructCreate("byte[" & $iLen1 & "];byte[" & $iLen2 & "]")
    DllStructSetData($struct, 1, $bBinary1)
    DllStructSetData($struct, 2, $bBinary2)
    
    Return DllStructGetData(DllStructCreate("byte[" & $iLen1 + $iLen2 & "]", DllStructGetPtr($struct)), 1)
    
EndFunc   ;==>_WinHttpBinaryConcatoÝ÷ Ù8Z¶+(¥éâaÊh²ÈX­É«­¢+Ø¥¹±ÕÅÕ½Ðí]¥¹!QQ@¹ÔÌÅÕ½Ðì(()±½°ÀÌØí¡Ý}½Á¸ô}]¥¹!ÑÑÁ=Á¸ ¤)%ÉɽÈQ¡¸(%5Í  ½à Ðà°ÅÕ½ÐíÉɽÈÅÕ½Ðì°ÅÕ½ÐíÉɽȥ¹¥Ñ¥±¥é¥¹Ñ¡Õͽ]¥¹!QQ@չѥ½¹Ì¸ÅÕ½Ðì¤(%á¥Ð)¹%()±½°ÀÌØí¡Ý}½¹¹Ðô}]¥¹!ÑÑÁ
½¹¹Ð ÀÌØí¡Ý}½Á¸°ÅÕ½ÐíÝÝܹÕѽ¥Ð¹ÅÕ½Ðì¤)%ÉɽÈQ¡¸(%5Í    ½à Ðà°ÅÕ½ÐíÉɽÈÅÕ½Ðì°ÅÕ½ÐíÉɽÈÍÁ¥å¥¹Ñ¡¥¹¥Ñ¥°ÑÉÐÍÉÙȽ¸!QQ@ÉÅÕÍиÅÕ½Ðì¤(%}]¥¹!ÑÑÁ
±½Í!¹± ÀÌØí¡Ý}½Á¸¤(%á¥Ð)¹%()±½°ÀÌØí¡}½Á¹IÅÕÍÐô}]¥¹!ÑÑÁ=Á¹IÅÕÍÐ ÀÌØí¡Ý}½¹¹Ð¤)%ÉɽÈQ¡¸(%5Í    ½à Ðà°ÅÕ½ÐíÉɽÈÅÕ½Ðì°ÅÕ½ÐíÉɽÈÉÑ¥¹¸!QQ@ÉÅÕÍС¹±¸ÅÕ½Ðì¤(%}]¥¹!ÑÑÁ
±½Í!¹± ÀÌØí¡Ý}½¹¹Ð¤(%}]¥¹!ÑÑÁ
±½Í!¹± ÀÌØí¡Ý}½Á¸¤(%á¥Ð)¹%()}]¥¹!ÑÑÁM¹IÅÕÍÐ ÀÌØí¡}½Á¹IÅÕÍФ)%ÉɽÈQ¡¸(%5Í   ½à Ðà°ÅÕ½ÐíÉɽÈÅÕ½Ðì°ÅÕ½ÐíÉɽÈ͹¥¹Ñ¡ÍÁ¥¥ÉÅÕÍиÅÕ½Ðì¤(%}]¥¹!ÑÑÁ
±½Í!¹± ÀÌØí¡Ý}½¹¹Ð¤(%}]¥¹!ÑÑÁ
±½Í!¹± ÀÌØí¡Ý}½Á¸¤(%á¥Ð)¹%()}]¥¹!ÑÑÁI¥ÙIÍÁ½¹Í ÀÌØí¡}½Á¹IÅÕÍФ()%}]¥¹!ÑÑÁEÕÉåÑÙ¥±± ÀÌØí¡}½Á¹IÅÕÍФQ¡¸(%±½°ÀÌØí¡Èô}]¥¹!ÑÑÁEÕÉå!ÉÌ ÀÌØí¡}½Á¹IÅÕÍФ(%
½¹Í½±]É¥Ñ ÀÌØí¡ÈµÀì
I1µÀì
I1¤(%±½°ÀÌØí¡Õ¹¬°ÀÌØíÑ°ÀÌØíáѹ(%]¡¥±Ä($$ÀÌØí¡Õ¹¬ôa}]¥¹!ÑÑÁIÑ ÀÌØí¡}½Á¹IÅÕÍаĤ($%%9½ÐáѹQ¡¸á¥Ñ1½½À($$ÀÌØíѵÀìôÀÌØí¡Õ¹¬$(%]¹(%
½¹Í½±]É¥Ñ ÀÌØíѵÀì
I1¤)±Í(%5Í  ½à Ðà°ÅÕ½ÐíÉɽÈÅÕ½Ðì°ÅÕ½ÐíM¥Ñ¥ÌáÁÉ¥¹¥¹Áɽ±µÌ¸ÅÕ½Ðì¤)¹%()}]¥¹!ÑÑÁ
±½Í!¹± ÀÌØí¡}½Á¹IÅÕÍФ)}]¥¹!ÑÑÁ
±½Í!¹± ÀÌØí¡Ý}½¹¹Ð¤)}]¥¹!ÑÑÁ
±½Í!¹± ÀÌØí¡Ý}½Á¸¤(((ìU9
Q%=8ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô(ì(ì9µ¸¸¸¸¸¸¸¸¸¸¸è}]¥¹!ÑÑÁIÑ(ìÍÉ¥ÁÑ¥½¸¸¸¸èIÌÑɽ´¡¹±½Á¹äÑ¡}]¥¹!ÑÑÁ=Á¹IÅÕÍÐ ¤Õ¹Ñ¥½¸¸(ìMå¹Ñุ¸¸¸¸¸¸¸è}]¥¹!ÑÑÁIÑ ÀÌØí¡IÅÕÍÐl°¥5½l°ÀÌØí¥9ÕµÉ=  åÑÍQ½Iut¤(ìAɵÑÉ̸¸¸¸èÀÌØí¡IÅÕÍдY±¥¡¹±ÉÑÕɹɽ´ÁÉÙ¥½Õ̱°Ñ¼}]¥¹!ÑÑÁ=Á¹IÅÕÍÐ ¤¸(ìÀÌØí¥5½´%¹ÑÈÉÁÉ͹ѥ¹É¥¹µ½¸Õ±Ð¥ÌÀ¡¡ÉÍÐ¥ÌÑ­¸Ñ¼9M$ɱѤ¸(ìÀÌØí¥9ÕµÉ= åÑÍQ½I´%¹ÑÈÙ±Õѡн¹Ñ¥¹ÌÑ¡¹ÕµÈ½åÑÌѼɸձХÌàÄäÈåÑ̸(ìIÑÕɸٱÕ̸èMÕÍÌ´IÑÕɹÌÑɸ(ì´MÑÌÉɽÈѼÀ(쥱ÕÉ´IÑÕɹ̵ÁÑäÍÑÉ¥¹¹ÍÑÌÉɽÈè(ìðÄ´±±
±°¥±¸(ìÕÑ¡½È¸¸¸¸¸¸¸¸èÑɹáà°Aɽ¹ä(ì5½¥¥¸¸¸¸¸¸¸è(ìIµÉ­Ì¸¸¸¸¸¸¸è¥5½¸¡ÙÑ¡ÍÙ±ÕÌè(ìðÀ´9M$(ìðÄ´UQà(ìðÈ´   ¥¹Éä(ìI±Ñ¸¸¸¸¸¸¸è(ì1¥¹¬¸¸¸¸¸¸¸¸¸¸ì¡ÑÑÀè¼½µÍ¸¹µ¥É½Í½Ð¹½´½¸µÕ̽±¥ÉÉä½ÌàÐÄÀСYL¸àÔ¤¹ÍÁà(ìáµÁ±¸¸¸¸¸¸¸ìeÌ(ì(ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô)Õ¹a}]¥¹!ÑÑÁIÑ ÀÌØí¡IÅÕÍаÀÌØí¥5½ôÀ°ÀÌØí¥9ÕµÉ= åÑÍQ½IôàÄäȤ((%1½°ÀÌØí±Á  ÕÈ($(%MÝ¥Ñ ÀÌØí¥5½($%
ÍÀ($$$ÀÌØí±Á    ÕÈô±±MÑÉÕÑ
ÉÑ ÅÕ½Ðí¡ÉlÅÕ½ÐìµÀìÀÌØí¥9ÕµÉ=  åÑÍQ½IµÀìÅÕ½ÐítÅÕ½Ðì¤($%
ÍÄ°È($$$ÀÌØí±Á    ÕÈô±±MÑÉÕÑ
ÉÑ ÅÕ½ÐíåÑlÅÕ½ÐìµÀìÀÌØí¥9ÕµÉ=  åÑÍQ½IµÀìÅÕ½ÐítÅÕ½Ðì¤(%¹MÝ¥Ñ ($(%1½°ÀÌØí}¥
±°ô±±
±° ÅÕ½Ðí]¥¹¡ÑÑÀ¹±°ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½Ðí]¥¹!ÑÑÁIÑÅÕ½Ðì°|($$$ÅÕ½Ðí¡Ý¹ÅÕ½Ðì°ÀÌØí¡IÅÕÍа|($$$ÅÕ½ÐíÁÑÈÅÕ½Ðì°±±MÑÉÕÑÑAÑÈ ÀÌØí±Á ÕȤ°|($$$ÅÕ½ÐíÕ±½¹ÅÕ½Ðì°ÀÌØí¥9ÕµÉ=   åÑÍQ½I°|($$$ÅÕ½ÐíݽɨÅÕ½Ðì°À¤((%%ÉɽÈ=È9½ÐÀÌØí}¥
±±lÁtQ¡¸($%MÑÉÉ½È Ä°À°ÅÕ½ÐìÅÕ½Ðì¤(%¹%((%MÝ¥Ñ ÀÌØí¥5½($%
ÍÀ($$%IÑÕɸMÑÉÉ½È À°ÀÌØí}¥
±±lÑt°MÑÉ¥¹1С±±MÑÉÕÑÑÑ ÀÌØí±Á  ÕȰĤ°ÀÌØí}¥
±±lÑt¤¤($%
ÍÄ($$%IÑÕɸMÑÉÉ½È À°ÀÌØí}¥
±±lÑt°  ¥¹ÉåQ½MÑÉ¥¹¡  ¥¹Éå5¥¡±±MÑÉÕÑÑÑ ÀÌØí±Á ÕȰĤ°Ä°ÀÌØí}¥
±±lÑt¤°Ð¤¤($%
ÍÈ($$%IÑÕɸMÑÉÉ½È À°ÀÌØí}¥
±±lÑt°  ¥¹Éå5¥¡±±MÑÉÕÑÑÑ ÀÌØí±Á ÕȰĤ°Ä°ÀÌØí}¥
±±lÑt¤¤(%¹MÝ¥Ñ ()¹Õ¹

Prefix "X" is used not to colide with current _WinHttpReadData() function

 

Find flaw, if any.

Maybe to set UTF-8 as default?

I sent the request to sever http data

_WinHttpSendRequest


then send it back to my server data

_WinHttpReadData


now
the received data I want to save the information I received
eg: photos
how to save the photos I receive?

Share this post


Link to post
Share on other sites

I am struggling with Dropbox.  Link is here. I got to authenticate.  Now I am trying basics, like create folder, or upload file, and am not managing.

Does anyone have an example?  Specificially HTTP, I find the HTTP easier - I do not understand any of the DLL / API programming examples...

:)

I made a sandbox for testing. am willing to  share tokens by PM.

Edited by Skysnake
Sandbox

Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites

 

4 hours ago, Skysnake said:

I am struggling with Dropbox.  Link is here. I got to authenticate.  Now I am trying basics, like create folder, or upload file, and am not managing.

Does anyone have an example?  Specificially HTTP, I find the HTTP easier - I do not understand any of the DLL / API programming examples...

:)

I made a sandbox for testing. am willing to  share tokens by PM.

Hit me with a mail and I'll have a look.

Share this post


Link to post
Share on other sites

i use winhttp to login and retrive update pricelist from many our distributor, only for one i can't able to complete login form, this: 

https://it-new.ingrammicro.com/_layouts/CommerceServer/IM/Login.aspx?

every example script from github and this forum i tried to fill login form result in null return or error with no username or password insert.

any advice to solve this ?

many thanks.! 

Share this post


Link to post
Share on other sites
5 hours ago, Massimo said:

i use winhttp to login and retrive update pricelist from many our distributor, only for one i can't able to complete login form, this: 

https://it-new.ingrammicro.com/_layouts/CommerceServer/IM/Login.aspx?

every example script from github and this forum i tried to fill login form result in null return or error with no username or password insert.

any advice to solve this ?

many thanks.! 

Can you show me the code you tried?

Share this post


Link to post
Share on other sites

Need some help with WinHTTP Send function having complex input parameter list. Here is the thread.

Need this badly. Any quick help is greatly appreciated!

 

Share this post


Link to post
Share on other sites
On 18/8/2016 at 6:10 PM, trancexx said:

Can you show me the code you tried?

; Initialize and get session handle
$hOpen = _WinHttpOpen()
; Get connection handle
$hConnect = _WinHttpConnect($hOpen, "it-new.ingrammicro.com")
; Fill form on this page
$aRead = _WinHttpSimpleFormFill($hConnect, "_layouts/CommerceServer/IM/Login.aspx?", _
        Default, _
        "name:ctl00$PlaceHolderMain$txtUserEmail", "xxxxxxxxxxxxxx", _
        "name:ctl00$PlaceHolderMain$txtPassword", "yyyyyyyyyyyyyy", _
        "type:submit", 1 _ ; third button (zero-based counting scheme)
        )
; Close connection handle
_WinHttpCloseHandle($hConnect)
; Close session handle
_WinHttpCloseHandle($hOpen)

MsgBox(4096, "Returned", $aRead)

test also with other Example script and with index:1 and "type:submit", 2

Share this post


Link to post
Share on other sites
6 hours ago, Massimo said:
; Initialize and get session handle
$hOpen = _WinHttpOpen()
; Get connection handle
$hConnect = _WinHttpConnect($hOpen, "it-new.ingrammicro.com")
; Fill form on this page
$aRead = _WinHttpSimpleFormFill($hConnect, "_layouts/CommerceServer/IM/Login.aspx?", _
        Default, _
        "name:ctl00$PlaceHolderMain$txtUserEmail", "xxxxxxxxxxxxxx", _
        "name:ctl00$PlaceHolderMain$txtPassword", "yyyyyyyyyyyyyy", _
        "type:submit", 1 _ ; third button (zero-based counting scheme)
        )
; Close connection handle
_WinHttpCloseHandle($hConnect)
; Close session handle
_WinHttpCloseHandle($hOpen)

MsgBox(4096, "Returned", $aRead)

test also with other Example script and with index:1 and "type:submit", 2

I see credentials sent. But I don't see why the login fail, because I don't have correct credentials to begin with.

Can you create some test account and share credentials with me so that I can debug it?

Share this post


Link to post
Share on other sites
On 30/8/2016 at 5:49 PM, trancexx said:

I see credentials sent. But I don't see why the login fail, because I don't have correct credentials to begin with.

Can you create some test account and share credentials with me so that I can debug it?

sent private message

Share this post


Link to post
Share on other sites

@trancexx Hi, can you please give me a healthy shove in the right direction? I'm a Systems Tester, automating testing of web based applications. As part of the output I log as much as I can concerning the system-under-test.  This code is for example.

#include <_sql.au3>

FileOpen("Server Versions.txt")

Local $ServerAddress = "xx.xx.xx.xx"
Local $ServerUserName = "name"
Local $ServerPassword = "PWPWPW"
Local $DatabaseName = "DbName"

;names changed to protect the innocent.

func SQLConnect()
_SQL_RegisterErrorHandler();register the error handler to prevent hard crash on COM error
$OADODB = _SQL_Startup()
If $OADODB = $SQL_ERROR Then MsgBox(0 + 16 + 262144, "Error", _SQL_GetErrMsg())
If _sql_Connect(-1, $ServerAddress, $DatabaseName, $ServerUserName, $ServerPassword) = $SQL_ERROR Then
MsgBox(0 + 16 + 262144, "Error 1", _SQL_GetErrMsg())
_SQL_Close()
Exit
EndIf

EndFunc

Func _NETFramework4_Win8()
    Local $sRegKey, $iKey, $sHold, $sNETRegKey
$sRegKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Dependencies\"
$iKey = 1
While 1
    $sHold = RegEnumKey($sRegKey, $iKey)
    If @error Then ExitLoop
    $iKey += 1
    If RegRead($sRegKey & $sHold, "DisplayName") = 'Microsoft .NET Framework 4.5 Multi-Targeting Pack' Then
        $sNETRegKey = RegRead($sRegKey & $sHold, "Version")
        If Not @error Then
            ExitLoop
        EndIf
    EndIf
WEnd
;MsgBox(4096, "Result", "Microsoft .NET Framework 4.5.2" & @CRLF & "version: " & $sNETRegKey)
FileWrite("Server Versions.txt","Microsoft .NET Framework  "& @CRLF & $sNETRegKey  & @CRLF & @CRLF)
EndFunc

Local $SQLVersion

SQLConnect()
_SQL_QuerySingleRow (-1,"select @@VERSION", $SQLVersion)
;MsgBox(4096, "Result", "SQL Version" & @CRLF & "version: " & $SQLversion[0])
FileWrite("Server Versions.txt","SQL Version "& @CRLF & $SQLversion[0] & @CRLF & @CRLF)

$IEVersion = FileGetVersion(@ProgramFilesDir & "\Internet Explorer\iexplore.exe")
;MsgBox(4096, "Result", "Microsoft IE" & @CRLF & "version: " & $IEversion)
FileWrite("Server Versions.txt","IE Version "& @CRLF & $IEversion & @CRLF & @CRLF)

$version = @OSVersion
;MsgBox(4096, "Result", "Microsoft OS" & @CRLF & "version: " & $version)
FileWrite("Server Versions.txt","Microsoft OS Version " & @CRLF & $version & @CRLF & @CRLF)

$build = @OSBuild
;MsgBox(4096, "Result", "Microsoft OS Build" & @CRLF & "Build: " & $build)
FileWrite("Server Versions.txt","Microsoft OS Build "  & @CRLF & $build & @CRLF & @CRLF)

$ComputerName = @ComputerName
;MsgBox(4096, "Result", "Computer Name" & @CRLF & $ComputerName)
FileWrite("Server Versions.txt","Computer Name "  & @CRLF & $ComputerName & @CRLF & @CRLF)

$IPAddy = @IPAddress1
;MsgBox(4096, "Result", "IP Address" & @CRLF & $IPAddy)
FileWrite("Server Versions.txt","IP Address "& @CRLF & $IPAddy & @CRLF & @CRLF)

if $version = 'WIN_81' Or $version = 'WIN_8' Or $version = 'WIN_2012' Or $version = 'WIN_2012R2' Then
    _NETFramework4_win8()
EndIf

I need to log the IE connection state, as recorded in the properties of the web page... Easy to display, impossible to capture! e.g.

#include <IE.au3>
#include <MsgBoxConstants.au3>
Opt("WinDetectHiddenText", 1)
Opt("TrayIconDebug",1)


Local $oIE = _IECreate("bbc.co.uk")

_IELoadWait($oIE)

Sleep(2000)

Send("!f")
Sleep(500)
Send("r")

I'm expecting "TLS 1.2, AES with 256 bit encryption (High); DH with 1024 bit exchange" or whatever the page under test reports.

Any assistance greatly appreciated!

Pete


The AutoIt help file should be interrogated.The Editor should be SciTe.The forums should have been searched.

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

Hi @Danyfirex. Many thanks for the reply, Unfortunately, as a tester I find developer-speak a bit of a nightmare! All I'm trying to get is a single line of text describing the connection state. I can get it displayed on the screen using File>>Properties in Internet explorer, I just can't get AutoIT to capture it! I'll have my developer take a look, but your answer is over my head!

Cheers

Pete


The AutoIt help file should be interrogated.The Editor should be SciTe.The forums should have been searched.

Share this post


Link to post
Share on other sites

@System Tester mmm I see. you're looking for a simple solution. to handle that IE window you need to use IUIAutomation : 

 

 

Saludos

Share this post


Link to post
Share on other sites

@System Tester, whether SSL or TLS is used is negotiated between client (you) and server. The result can be anything in case of no preferences. For example, in WinHttp you can force any protocol, and server may say "ok, let's do it that way". IE can do the same, and thus you'd have possibly different results.

This site "uses" TLS 1.0, 1.1, 1.2 and SSL 3.0, but not SSL 2.0

Share this post


Link to post
Share on other sites

Thanks trancexx! As a tester, I just need to report the connection condition, This is not only an indicator of the software operation, but also whether it's been installed & configured correctly.

So in my simple (and it really is!) universe, all I want to do is read the text of the IE dialogue File>>Properties.

JLogan3o13 mentioned there was an "easy" way to capture this info, but didn't mention what it was. 184525-internet-explorer-properties

Thanks again!


The AutoIt help file should be interrogated.The Editor should be SciTe.The forums should have been searched.

Share this post


Link to post
Share on other sites

Hi 

can you give the example that i can request a link auth-parm 

like 

when i give this 

http://download.oracle.com/otn-pub/java/jdk-nb/8u101-8.1/jdk-8u101-nb-8_1-windows-x64.exe

i can receive this link with temporary AuthParm ? 
http://download.oracle.com/otn-pub/java/jdk-nb/8u101-8.1/jdk-8u101-nb-8_1-windows-x64.exe?AuthParam=1474790381_0fee755787a7d73f2f42549cee65ab35

Internet Download manger can do that but i want to do that with Autoit 

Share this post


Link to post
Share on other sites

Hi,

I have been using _WinHttpSimpleSendRequest and _WinHttpSimpleReadData to access the USPS Web Tools API. I recently received an email from them stating

Quote

This message explains some security improvements planned for our services. Effective March 2017 (exact date to be determined), Web Tools will discontinue support of SSLv3 for securing connections to our HTTPS APIs including all shipping label and package pickup APIs. After this change, integrations leveraging SSLv3 will fail when attempting to access the APIs.

What actions do I need to take to ensure that my WinHTTP requests are using TLS and not SSLv3?

Thanks!

Dan

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

×
×
  • Create New...