Scriptonize

Sending files using HTTP post: (total bytes written = 0)

3 posts in this topic

#1 ·  Posted (edited)

Hi everybody,

I'm currently working on a script for sending files to a remote server by using the HTTP post method.

It's not my fav. way of sending files, but the remote party only supports this method.

So be it.

After digging through many examples over the net, I've managed to create a script that seems to do the trick.

There is one issue with my approach.

When I'm checking the returned @extended value from _WinHttpWriteData it always returns 0, despite a 200 OK status code from the remote site.

How come, what am I doing wrong here.

The script runs against a public httppost test server, so if needed you can run the script as well.

Thanks for your time.

#include <WinHttp.au3>

If FileExists(@ScriptDir & "\a_text_file.txt") Then
    SendFile("a_text_file.txt")
Else
    MsgBox(64,"Error","Unknown file, nothing to do")
EndIf

If FileExists(@ScriptDir & "\another_text_file.txt") Then
    SendFile("another_text_file.txt")
Else
    MsgBox(64,"Error","Unknown file, nothing more to do")
EndIf

Exit

Func SendFile($sFileName)


    Local $sFolder = @ScriptDir & "\"
    Local $sFileData = FileRead($sFolder & $sFileName)
    Local $iFileLen = StringLen($sFileData)

    Local $bUseProxy = 0
    Local $sProxyIP = "0.0.0.0"
    Local $sProxyPort = "8080"

    Local $sUserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0"
    Local $sMethod = "POST"
    Local $sHttpVersion = "HTTP/1.1"

    Local $iBytesWritten
    Local $sResponseHeader
    Local $sResponseData
    Local $hSession
    Local $hConnect
    Local $hRequest

    Local $sUrlPrefix = "http://"
    Local $sHostName = "posttestserver.com"
    Local $sUrlSuffix = "/"
    Local $sPHP_Script = "post.php"
    Local $sPHP_Param = "?dump&html&dir=testing_the_script"

    Local $sUserName = ""
    Local $sUserPass = ""

    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    ; 1) Create/Open a session handle
    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    ;Depending on using a proxy we use the appropriate function call
    If $bUseProxy = 1 Then
        $hSession = _WinHttpOpen($sUserAgent,$WINHTTP_ACCESS_TYPE_NAMED_PROXY,$sProxyIP & ":" & $sProxyPort,$WINHTTP_NO_PROXY_BYPASS,0)
        If @error Then ConsoleWriteError("Step 1) _WinHttpOpen(" & $sUserAgent & "," & $WINHTTP_ACCESS_TYPE_NAMED_PROXY & "," & $sProxyIP & ":" & $sProxyPort & "," & $WINHTTP_NO_PROXY_BYPASS & ",0) raises error: " & @error & @CRLF)
        ConsoleWrite("Step 1) Proxy ==> $hSession: " & $hSession & @CRLF)
    Else
        $hSession = _WinHttpOpen($sUserAgent, $WINHTTP_ACCESS_TYPE_NO_PROXY,$WINHTTP_NO_PROXY_NAME,$WINHTTP_NO_PROXY_BYPASS,0)
        If @error Then ConsoleWriteError("Step 1) _WinHttpOpen(" & $sUserAgent & "," & $WINHTTP_ACCESS_TYPE_NO_PROXY & "," & $WINHTTP_NO_PROXY_NAME & "," & $WINHTTP_NO_PROXY_BYPASS & ",0) raises error: " & @error & @CRLF)
        ConsoleWrite("Step 1) No proxy ==> $hSession: " & $hSession & @CRLF)
    EndIf


    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    ; 2) Create/Open connection handle
    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    ; Are we using HTTP or HTTPS?
    If StringInStr($sUrlPrefix,"Https",0) Then  ; HTTPS
        If $hSession Then $hConnect = _WinHttpConnect($hSession,$sURLPrefix & $sHostName & $sUrlSuffix,$INTERNET_DEFAULT_HTTPS_PORT)
        ConsoleWrite("Step 2) Executing function _WinHttpConnect(" & $hSession & "," & $sURLPrefix & $sHostName & $sUrlSuffix & "," & $INTERNET_DEFAULT_HTTPS_PORT & ") " & @CRLF)
        ConsoleWrite("Step 2) $hConnect: " & $hConnect & @CRLF)

    Else        ; HTTP
        If $hSession Then $hConnect = _WinHttpConnect($hSession,$sURLPrefix & $sHostName & $sUrlSuffix,$INTERNET_DEFAULT_HTTP_PORT)
        ConsoleWrite("Step 2) Executing function _WinHttpConnect(" & $hSession & "," & $sURLPrefix & $sHostName & $sUrlSuffix & "," & $INTERNET_DEFAULT_HTTP_PORT & ") " & @CRLF)
        ConsoleWrite("Step 2) $hConnect: " & $hConnect & @CRLF)
    EndIf


    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    ; 3a) Create/Open a request handle
    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    ; Are we using HTTP or HTTPS?
    If StringInStr($sUrlPrefix,"Https",0) Then  ; HTTPS
        If $hConnect Then $hRequest = _WinHttpOpenRequest($hConnect,$sMethod, $sUrlSuffix & $sPHP_Script & $sPHP_Param, $sHttpVersion,$WINHTTP_NO_REFERER, "*/*", $WINHTTP_FLAG_SECURE)
        ConsoleWrite("Step 3a) Executing funcion: _WinHttpOpenRequest(" & $hConnect & "," & $sMethod & "," & $sUrlSuffix & $sPHP_Script & $sPHP_Param & "," & $sHttpVersion & "," & $WINHTTP_NO_REFERER & ",*/*," & $WINHTTP_FLAG_SECURE & ")" & @CRLF)
        ConsoleWrite("Step 3a) $hRequest: " & $hRequest & @CRLF)
    Else        ; HTTP
        If $hConnect Then $hRequest = _WinHttpOpenRequest($hConnect,$sMethod, $sUrlSuffix & $sPHP_Script & $sPHP_Param, $sHttpVersion,$WINHTTP_NO_REFERER, "*/*", Default)
        ConsoleWrite("Step 3a) Executing funcion: _WinHttpOpenRequest(" & $hConnect & "," & $sMethod & "," & $sUrlSuffix & $sPHP_Script & $sPHP_Param & "," & $sHttpVersion & "," & $WINHTTP_NO_REFERER & ",*/*," & Default & ")" & @CRLF)
        ConsoleWrite("Step 3a) $hRequest: " & $hRequest & @CRLF)
    EndIf

    If $sUserName <> "" Then
        ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ; 3b)Pass credentionals before sending a request
        ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        _WinHttpSetCredentials($hRequest, $WINHTTP_AUTH_TARGET_SERVER, $WINHTTP_AUTH_SCHEME_BASIC, $sUserName,$sUserPass)
        If @error Then ConsoleWriteError("Step 3b) _WinHttpSetCredentials raised an error: " & @error & @CRLF)
        ConsoleWrite("Step 3b) Executing funcion: _WinHttpSetCredentials(" & $hRequest & "," & $WINHTTP_AUTH_TARGET_SERVER & "," & $WINHTTP_AUTH_SCHEME_BASIC & "," & $sUserName & "," & $sUserPass & ")" & @CRLF)


        ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ; 3c)Send the request
        ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        If $hRequest Then _WinHttpSendRequest($hRequest,$WINHTTP_NO_ADDITIONAL_HEADERS,$WINHTTP_NO_REQUEST_DATA,0,0)
        If @error Then ConsoleWriteError("Step 3c) _WinHttpSendRequest raised an error: " & @error & @CRLF)
        ConsoleWrite("Step 3c) Executing funcion: _WinHttpSendRequest(" & $hRequest & "," & $WINHTTP_NO_ADDITIONAL_HEADERS & "," & $WINHTTP_NO_REQUEST_DATA & ",0,0)" & @CRLF)
        ConsoleWrite("Step 3c) $hRequest: " & $hRequest & @CRLF)


        ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ; 3d) End the request
        ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        _WinHttpReceiveResponse($hRequest)

        $sResponseHeader = _WinHttpQueryHeaders($hRequest)
        If @error Then ConsoleWriteError("Step 3d) _WinHttpQueryHeaders raised an error: " & @error & @CRLF)
        ConsoleWrite("Step 3d) $sResponseHeader: " & $sResponseHeader & @CRLF)

        $iStatusCode = _WinHttpQueryHeaders($hRequest,$WINHTTP_QUERY_STATUS_CODE)
        If @error Then ConsoleWriteError("Step 3d) _WinHttpQueryHeaders raised an error: " & @error & @CRLF)
        ConsoleWrite("Step 3d) $iStatusCode: " & $iStatusCode & @CRLF & @CRLF)
    EndIf


    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    ; 4) Send the next request
    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    _WinHttpSendRequest($hRequest,$WINHTTP_NO_ADDITIONAL_HEADERS, $sFileData, $iFileLen,Default)

    If @error Then ConsoleWriteError("Step 4) _WinHttpSendRequest raised an error: " & @error & @CRLF)
    ConsoleWrite("Step 4) Executing function _WinHttpSendRequest(" & $hRequest & "," & $WINHTTP_NO_ADDITIONAL_HEADERS & "," &  $sFileData & "," & $iFileLen & ",Default)" & @CRLF)
    ConsoleWrite("Step 4) $hRequest: " & $hRequest & @CRLF)


    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    ; 5) Write data to server
    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    _WinHttpWriteData($hRequest,$sFileData,0)

    ;Success - Returns 1
    ;- @extended receives the number of bytes written.

    $iBytesWritten = @extended
    ;Despite a successful post, @extended remains 0
    ;Why??????

    ConsoleWrite("Step 5) Executing function _WinHttpWriteData(" & $hRequest & "," & $sFileData & ",0)" & @CRLF)
    If @error Then
        ConsoleWriteError("Step 5) _WinHttpWriteData raised an error: " & @error & @CRLF)
    Else
        ConsoleWrite("Step 5) File " & $sFolder & $sFileName & " succesfully send to " & $sHostName & " Total bytes written: " & $iBytesWritten & @CRLF)
    EndIf


    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    ; 6) End the request
    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    _WinHttpReceiveResponse($hRequest)


    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    ; 7) Show response from server
    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    $sResponseHeader = _WinHttpQueryHeaders($hRequest)
    ConsoleWrite("Step 7) $sResponseHeader: " & $sResponseHeader & @CRLF)

    $iStatusCode = _WinHttpQueryHeaders($hRequest,$WINHTTP_QUERY_STATUS_CODE)
    ConsoleWrite("Step 7) $iStatusCode: " & $iStatusCode & @CRLF)
    ConsoleWrite("Step 7) Remote server responded with: " & _WinHttpReadData($hRequest) & @CRLF)


    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    ; 8) Close handles
    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    _winHttpCloseHandle($hRequest)
    _winHttpCloseHandle($hConnect)
    _winHttpCloseHandle($hSession)

EndFunc

a_text_file.txt

another_text_file.txt

Forum_PostFile.au3

Edited by Scriptonize

If you learn from It, it's not a mistake

Share this post


Link to post
Share on other sites



Nobody?


If you learn from It, it's not a mistake

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

After receiving some help, I've changed the script.

My error handling was wrong.

Now it works better.

Still, I'm not sure if a file upload using HTTP POST should be done like this.

Any comment is appreciated. :)

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=testing.exe
#AutoIt3Wrapper_Compile_Both=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#pragma compile(Console, true)
#include <WinHttp.au3>


If FileExists(@ScriptDir & "\this_is_test.txt") Then
    SendFile("this_is_test.txt")
Else
    MsgBox(64,"Error","Unknown file, nothing to do")
EndIf

If FileExists(@ScriptDir & "\this_is_another_test.txt") Then
    SendFile("this_is_another_test.txt")
Else
    MsgBox(64,"Error","Unknown file, nothing more to do")
EndIf

Exit

Func SendFile($sFileName)


    Local $sFolder = @ScriptDir & "\"
    Local $sFileData = FileRead($sFolder & $sFileName)
    Local $iFileLen = StringLen($sFileData)
    Local $iErr

    Local $bUseProxy = 0
    Local $sProxyIP = "0.0.0.0"
    Local $sProxyPort = "8080"

    Local $sUserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0"
    Local $sMethod = "POST"
    Local $sHttpVersion = "HTTP/1.1"

    Local $iBytesWritten
    Local $sResponseHeader
    Local $sResponseData
    Local $hSession
    Local $hConnect
    Local $hRequest

    Local $sUrlPrefix = "http://"
    Local $sHostName = "posttestserver.com"
    Local $sUrlSuffix = "/"
    Local $sPHP_Script = "post.php"
    Local $sPHP_Param = "?dump&html&dir=scriptonize_testing_the_script"

    Local $sUserName = ""
    Local $sUserPass = ""

    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    ; 1) Create/Open a session handle
    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    ;Depending on using a proxy we use the appropriate function call
    If $bUseProxy = 1 Then
        $hSession = _WinHttpOpen($sUserAgent,$WINHTTP_ACCESS_TYPE_NAMED_PROXY,$sProxyIP & ":" & $sProxyPort,$WINHTTP_NO_PROXY_BYPASS,0)
        $iErr = @error
        If $iErr Then
            ConsoleWriteError("Step 1) _WinHttpOpen(" & $sUserAgent & "," & $WINHTTP_ACCESS_TYPE_NAMED_PROXY & "," & $sProxyIP & ":" & $sProxyPort & "," & $WINHTTP_NO_PROXY_BYPASS & ",0) raises error: " & $iErr & @CRLF)
            $iErr = 0
        EndIf
        ConsoleWrite("Step 1) Proxy ==> $hSession: " & $hSession & @CRLF)
    Else
        $hSession = _WinHttpOpen($sUserAgent, $WINHTTP_ACCESS_TYPE_NO_PROXY,$WINHTTP_NO_PROXY_NAME,$WINHTTP_NO_PROXY_BYPASS,0)
        $iErr = @error
        If $iErr Then
            ConsoleWriteError("Step 1) _WinHttpOpen(" & $sUserAgent & "," & $WINHTTP_ACCESS_TYPE_NO_PROXY & "," & $WINHTTP_NO_PROXY_NAME & "," & $WINHTTP_NO_PROXY_BYPASS & ",0) raises error: " & $iErr & @CRLF)
            $iErr = 0
        EndIf
        ConsoleWrite("Step 1) No proxy ==> $hSession: " & $hSession & @CRLF)
    EndIf


    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    ; 2) Create/Open connection handle
    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    ; Are we using HTTP or HTTPS?
    If StringInStr($sUrlPrefix,"Https",0) Then    ; HTTPS
        If $hSession Then $hConnect = _WinHttpConnect($hSession,$sURLPrefix & $sHostName & $sUrlSuffix,$INTERNET_DEFAULT_HTTPS_PORT)
        ConsoleWrite("Step 2) Executing function _WinHttpConnect(" & $hSession & "," & $sURLPrefix & $sHostName & $sUrlSuffix & "," & $INTERNET_DEFAULT_HTTPS_PORT & ") " & @CRLF)
        ConsoleWrite("Step 2) $hConnect: " & $hConnect & @CRLF)

    Else        ; HTTP
        If $hSession Then $hConnect = _WinHttpConnect($hSession,$sURLPrefix & $sHostName & $sUrlSuffix,$INTERNET_DEFAULT_HTTP_PORT)
        ConsoleWrite("Step 2) Executing function _WinHttpConnect(" & $hSession & "," & $sURLPrefix & $sHostName & $sUrlSuffix & "," & $INTERNET_DEFAULT_HTTP_PORT & ") " & @CRLF)
        ConsoleWrite("Step 2) $hConnect: " & $hConnect & @CRLF)
    EndIf


    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    ; 3a) Create/Open a request handle
    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    ; Are we using HTTP or HTTPS?
    If StringInStr($sUrlPrefix,"Https",0) Then    ; HTTPS
        If $hConnect Then $hRequest = _WinHttpOpenRequest($hConnect,$sMethod, $sUrlSuffix & $sPHP_Script & $sPHP_Param, $sHttpVersion,$WINHTTP_NO_REFERER, "*/*", $WINHTTP_FLAG_SECURE)
        ConsoleWrite("Step 3a) Executing funcion: _WinHttpOpenRequest(" & $hConnect & "," & $sMethod & "," & $sUrlSuffix & $sPHP_Script & $sPHP_Param & "," & $sHttpVersion & "," & $WINHTTP_NO_REFERER & ",*/*," & $WINHTTP_FLAG_SECURE & ")" & @CRLF)
        ConsoleWrite("Step 3a) $hRequest: " & $hRequest & @CRLF)
    Else        ; HTTP
        If $hConnect Then $hRequest = _WinHttpOpenRequest($hConnect,$sMethod, $sUrlSuffix & $sPHP_Script & $sPHP_Param, $sHttpVersion,$WINHTTP_NO_REFERER, "*/*", Default)
        ConsoleWrite("Step 3a) Executing funcion: _WinHttpOpenRequest(" & $hConnect & "," & $sMethod & "," & $sUrlSuffix & $sPHP_Script & $sPHP_Param & "," & $sHttpVersion & "," & $WINHTTP_NO_REFERER & ",*/*," & Default & ")" & @CRLF)
        ConsoleWrite("Step 3a) $hRequest: " & $hRequest & @CRLF)
    EndIf

    If $sUserName <> "" Then
        ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ; 3b)Pass credentionals before sending a request
        ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        _WinHttpSetCredentials($hRequest, $WINHTTP_AUTH_TARGET_SERVER, $WINHTTP_AUTH_SCHEME_BASIC, $sUserName,$sUserPass)
        $iErr = @error
        If $iErr Then
            ConsoleWriteError("Step 3b) _WinHttpSetCredentials raised an error: " & $iErr & @CRLF)
            $iErr = 0
        EndIf
        ConsoleWrite("Step 3b) Executing funcion: _WinHttpSetCredentials(" & $hRequest & "," & $WINHTTP_AUTH_TARGET_SERVER & "," & $WINHTTP_AUTH_SCHEME_BASIC & "," & $sUserName & "," & $sUserPass & ")" & @CRLF)


        ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ; 3c)Send the request
        ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        If $hRequest Then _WinHttpSendRequest($hRequest,$WINHTTP_NO_ADDITIONAL_HEADERS,$WINHTTP_NO_REQUEST_DATA,0,0)
        $iErr = @error
        If $iErr Then
            ConsoleWriteError("Step 3c) _WinHttpSendRequest raised an error: " & $iErr & @CRLF)
            $iErr = 0
        EndIf
        ConsoleWrite("Step 3c) Executing funcion: _WinHttpSendRequest(" & $hRequest & "," & $WINHTTP_NO_ADDITIONAL_HEADERS & "," & $WINHTTP_NO_REQUEST_DATA & ",0,0)" & @CRLF)
        ConsoleWrite("Step 3c) $hRequest: " & $hRequest & @CRLF)


        ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ; 3d) End the request
        ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        _WinHttpReceiveResponse($hRequest)

        $sResponseHeader = _WinHttpQueryHeaders($hRequest)
        $iErr = @error
        If $iErr Then
            ConsoleWriteError("Step 3d) _WinHttpQueryHeaders raised an error: " & $iErr & @CRLF)
            $iErr = 0
        EndIf
        ConsoleWrite("Step 3d) $sResponseHeader: " & $sResponseHeader & @CRLF)

        $iStatusCode = _WinHttpQueryHeaders($hRequest,$WINHTTP_QUERY_STATUS_CODE)
        $iErr = @error
        If $iErr Then
            ConsoleWriteError("Step 3d) _WinHttpQueryHeaders raised an error: " & $iErr & @CRLF)
            $iErr = 0
        EndIf
        ConsoleWrite("Step 3d) $iStatusCode: " & $iStatusCode & @CRLF & @CRLF)
    EndIf


    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    ; 4) Send the next request
    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    _WinHttpSendRequest($hRequest,$WINHTTP_NO_ADDITIONAL_HEADERS, $sFileData, $iFileLen,Default)
    $iErr = @error

    If $iErr Then
        ConsoleWriteError("Step 4) _WinHttpSendRequest raised an error: " & $iErr & @CRLF)
        $iErr = 0
    EndIf
    ConsoleWrite("Step 4) Executing function _WinHttpSendRequest(" & $hRequest & "," & $WINHTTP_NO_ADDITIONAL_HEADERS & "," &  $sFileData & "," & $iFileLen & ",Default)" & @CRLF)
    ConsoleWrite("Step 4) $hRequest: " & $hRequest & @CRLF)



    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    ; 5) End the request
    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    _WinHttpReceiveResponse($hRequest)


    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    ; 6) Show response from server
    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    $sResponseHeader = _WinHttpQueryHeaders($hRequest)
    ConsoleWrite("Step 7) $sResponseHeader: " & $sResponseHeader & @CRLF)

    $iStatusCode = _WinHttpQueryHeaders($hRequest,$WINHTTP_QUERY_STATUS_CODE)
    ConsoleWrite("Step 6) $iStatusCode: " & $iStatusCode & @CRLF)
    ConsoleWrite("Step 6) Remote server responded with: " & _WinHttpReadData($hRequest) & @CRLF)


    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    ; 7) Close handles
    ; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    _winHttpCloseHandle($hRequest)
    _winHttpCloseHandle($hConnect)
    _winHttpCloseHandle($hSession)

EndFunc

Forum_PostFile _3.au3

Edited by Scriptonize

If you learn from It, it's not a mistake

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