Jump to content

Recommended Posts

  • Replies 946
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

The other day mikeytown2 posted one post in HTTP UDF's thread that got me thinking if there is better (different) method to send requests through the HTTP protocol to HTTP servers. There is Winhttp.d

Yes thanks. But the only valid warning is with unreferenced parameter inside __WinHttpFormUpload. I'll fix that.

Hey Raizeno, try this: #include "WinHttp.au3" $sAddress = "https://api.pushover.net/1/messages.json" $sApiToken = "av26ac2nAXLyPKg2QMy4zf9YcUjz2G" ; <-yours here $sUserKey = "uMQf396GvMgrsDr

Posted Images

Okay i ve been trying for hours and i cant seem to get this to work.

So i am trying to login into gmail using

www.google.com/accounts/ClientLogin

I checked their documentary and everything i even copied the sample they had and even encoded my url before doing a post. I just cant seem to get it to work , i get a weird response "‹" and i know the password and account are right i keep loggin in and on so i know they are right. Could anyone please lend me a hand.

#include "WinHTTP.au3"


Func _POSTRequest($domain, $file, $query)
    Local $hOpen, $hConnect, $hRequest
    $hOpen = _WinHttpOpen()
    $hConnect = _WinHttpConnect($hOpen, $domain)
    $hRequest = _WinHttpOpenRequest($hConnect, "POST", $file)
    _WinHttpAddRequestHeaders($hRequest, "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6")
    _WinHttpAddRequestHeaders($hRequest, "Content-Type: application/x-www-form-urlencoded")
    _WinHttpAddRequestHeaders($hRequest, "Connection: Keep-Alive")
    _WinHttpAddRequestHeaders($hRequest, "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
_WinHttpAddRequestHeaders($hRequest, "Accept-Language:  en-us,en;q=0.5")
_WinHttpAddRequestHeaders($hRequest, "Accept-Encoding: gzip,deflate")
_WinHttpAddRequestHeaders($hRequest, "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7")
_WinHttpAddRequestHeaders($hRequest, "Keep-Alive: 115")
_WinHttpAddRequestHeaders($hRequest, "Connection: keep-alive")
    _WinHttpSendRequest($hRequest, $WINHTTP_NO_ADDITIONAL_HEADERS, $query)
    _WinHttpReceiveResponse($hRequest)
    $hResponse = _WinHttpReadData($hRequest)
    _WinHttpCloseHandle($hRequest)
    _WinHttpCloseHandle($hConnect)
    _WinHttpCloseHandle($hOpen)
$header = _WinHttpQueryHeaders($hRequest)

    Return $hresponse
EndFunc




$send = _POSTRequest("www.google.com","/accounts/ClientLogin","accountType=HOSTED_OR_GOOGLE&Email=myemail@gmail.com&Passwd=mypassword&service=mail&source=Gulp-CalGulp-1.05")
MsgBox(0,"",$send)
Edited by kenunloaded
Link to post
Share on other sites

i even tried this tool

http://web-sniffer.net/

posted a POST and a GET , both worked and i got the 3 values i was expecting.

SID

LSID

Auth

But for some reason i cant get it to work in autoit. I even tried copying the headers from that tool to match them equally and i still get the same weird response.

Link to post
Share on other sites

First thing to spot is you using "Accept-Encoding: gzip,deflate".

Where do you decompress data you receive? Lose that line.

Func _POSTRequest($domain, $file, $query)
    Local $hOpen, $hConnect, $hRequest
    $hOpen = _WinHttpOpen()
    $hConnect = _WinHttpConnect($hOpen, $domain)
    $hRequest = _WinHttpOpenRequest($hConnect, "POST", $file)
    _WinHttpAddRequestHeaders($hRequest, "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6")
    _WinHttpAddRequestHeaders($hRequest, "Content-Type: application/x-www-form-urlencoded")
    _WinHttpAddRequestHeaders($hRequest, "Connection: Keep-Alive")
    _WinHttpSendRequest($hRequest, $WINHTTP_NO_ADDITIONAL_HEADERS, $query)
    _WinHttpReceiveResponse($hRequest)
    $hResponse = _WinHttpReadData($hRequest)
$header = _WinHttpQueryHeaders($hRequest)   
   _WinHttpCloseHandle($hRequest)
    _WinHttpCloseHandle($hConnect)
    _WinHttpCloseHandle($hOpen)

    Return $header
EndFunc

so would this function do better. thanks for your reply i appreciated.

Edited by kenunloaded
Link to post
Share on other sites

Also, you do not have to set the User-Agent as a request-header. Just add it as parameter to _WinHttpOpen. And you can use the header-parameter of SendRequest :blink: Also, your data reading is incorrect.

Func _POSTRequest($domain, $file, $query)
    Local $hOpen, $hConnect, $hRequest
    $hOpen = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6")
    $hConnect = _WinHttpConnect($hOpen, $domain)
    $hRequest = _WinHttpOpenRequest($hConnect, "POST", $file)
    _WinHttpAddRequestHeaders($hRequest, "Connection: Keep-Alive")
    _WinHttpSendRequest($hRequest, "Content-Type: application/x-www-form-urlencoded", $query)
    _WinHttpReceiveResponse($hRequest)
    Local $aReturn[2]= ['', '']
    If _WinHttpQueryDataAvailable($hRequest) Then
        Do
            $aReturn[1] &= _WinHttpReadData($hRequest)
        Until 0=@extended
    EndIf
    $aReturn[0] = _WinHttpQueryHeaders($hRequest)   
    _WinHttpCloseHandle($hRequest)
    _WinHttpCloseHandle($hConnect)
    _WinHttpCloseHandle($hOpen)

    Return $aReturn ; Array: [0]: headers, [1]: received data.
EndFunc
Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to post
Share on other sites

Also, you do not have to set the User-Agent as a request-header. Just add it as parameter to _WinHttpOpen. And you can use the header-parameter of SendRequest :blink:

Func _POSTRequest($domain, $file, $query)
    Local $hOpen, $hConnect, $hRequest
    $hOpen = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6")
    $hConnect = _WinHttpConnect($hOpen, $domain)
    $hRequest = _WinHttpOpenRequest($hConnect, "POST", $file)
    _WinHttpAddRequestHeaders($hRequest, "Connection: Keep-Alive")
    _WinHttpSendRequest($hRequest, "Content-Type: application/x-www-form-urlencoded", $query)
    _WinHttpReceiveResponse($hRequest)
    $hResponse = _WinHttpReadData($hRequest)
$header = _WinHttpQueryHeaders($hRequest)   
   _WinHttpCloseHandle($hRequest)
    _WinHttpCloseHandle($hConnect)
    _WinHttpCloseHandle($hOpen)

    Return $header
EndFunc

well try it yourself, login with gmail and put your password and it wont login , it will give you bad=authentication

which is not true. I tried your function too and it wouldnt work even though when i try to inser the same url

http://web-sniffer.net/ here with the same post data it actually works but for some reason it is not working with autoit.

Link to post
Share on other sites

well try it yourself, login with gmail and put your password and it wont login , it will give you bad=authentication

which is not true. I tried your function too and it wouldnt work even though when i try to inser the same url

http://web-sniffer.net/ here with the same post data it actually works but for some reason it is not working with autoit.

https://www.google.com/accounts/ClientLogin

That 's' actually means something.

♡♡♡

.

eMyvnE

Link to post
Share on other sites

If it is a SSL-connection, you have to add the secure-flag:

#include<WinHTTP.au3>

Func _POSTRequest($domain, $file, $query, $flags = 0)
    Local $hOpen, $hConnect, $hRequest
    $hOpen = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6")
    $hConnect = _WinHttpConnect($hOpen, $domain)
    $hRequest = _WinHttpOpenRequest($hConnect, "POST", $file, 'HTTP/1.1', $WINHTTP_NO_REFERER, $WINHTTP_DEFAULT_ACCEPT_TYPES, $flags)
    _WinHttpAddRequestHeaders($hRequest, "Connection: Keep-Alive")
    _WinHttpSendRequest($hRequest, "Content-Type: application/x-www-form-urlencoded", $query)
    _WinHttpReceiveResponse($hRequest)
    Local $aReturn[2]= ['', '']
    If _WinHttpQueryDataAvailable($hRequest) Then
        Do
            $aReturn[1] &= _WinHttpReadData($hRequest)
        Until 0=@extended
    EndIf
    $aReturn[0] = _WinHttpQueryHeaders($hRequest)
    _WinHttpCloseHandle($hRequest)
    _WinHttpCloseHandle($hConnect)
    _WinHttpCloseHandle($hOpen)

    Return $aReturn ; Array: [0]: headers, [1]: received data.
EndFunc
$aReturn = _POSTRequest("www.google.com","/accounts/ClientLogin","accountType=HOSTED_OR_GOOGLE&Email=[MAIL@ADDRESS]&Passwd=[PASSWORD]&service=mail&source=Gulp-CalGulp-1.05", $WINHTTP_FLAG_SECURE)
MsgBox(0, '', $aReturn[0] )
MsgBox(0, '', $aReturn[1] )
Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to post
Share on other sites

I had this:

Func _POSTRequest($domain, $file, $query)
    Local $hOpen, $hConnect, $hRequest
    $hOpen = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6")
    $hConnect = _WinHttpConnect($hOpen, $domain, $INTERNET_DEFAULT_HTTPS_PORT)
    $hRequest = _WinHttpOpenRequest($hConnect, "POST", $file, 'HTTP/1.1', $WINHTTP_NO_REFERER, $WINHTTP_DEFAULT_ACCEPT_TYPES, $WINHTTP_FLAG_SECURE)
    _WinHttpAddRequestHeaders($hRequest, "Connection: Keep-Alive")
    _WinHttpSendRequest($hRequest, "Content-Type: application/x-www-form-urlencoded", $query)
    _WinHttpReceiveResponse($hRequest)
    Local $aReturn[2] = ['', '']
    If _WinHttpQueryDataAvailable($hRequest) Then
        Do
            $aReturn[1] &= _WinHttpReadData($hRequest)
        Until @error
    EndIf
    $aReturn[0] = _WinHttpQueryHeaders($hRequest)
    _WinHttpCloseHandle($hRequest)
    _WinHttpCloseHandle($hConnect)
    _WinHttpCloseHandle($hOpen)
    Return $aReturn ; Array: [0]: headers, [1]: received data.
EndFunc
Edited by trancexx

♡♡♡

.

eMyvnE

Link to post
Share on other sites

If it is a SSL-connection, you have to add the secure-flag:

#include<WinHTTP.au3>

Func _POSTRequest($domain, $file, $query, $flags = 0)
    Local $hOpen, $hConnect, $hRequest
    $hOpen = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6")
    $hConnect = _WinHttpConnect($hOpen, $domain)
    $hRequest = _WinHttpOpenRequest($hConnect, "POST", $file, 'HTTP/1.1', $WINHTTP_NO_REFERER, $WINHTTP_DEFAULT_ACCEPT_TYPES, $flags)
    _WinHttpAddRequestHeaders($hRequest, "Connection: Keep-Alive")
    _WinHttpSendRequest($hRequest, "Content-Type: application/x-www-form-urlencoded", $query)
    _WinHttpReceiveResponse($hRequest)
    Local $aReturn[2]= ['', '']
    If _WinHttpQueryDataAvailable($hRequest) Then
        Do
            $aReturn[1] &= _WinHttpReadData($hRequest)
        Until 0=@extended
    EndIf
    $aReturn[0] = _WinHttpQueryHeaders($hRequest)
    _WinHttpCloseHandle($hRequest)
    _WinHttpCloseHandle($hConnect)
    _WinHttpCloseHandle($hOpen)

    Return $aReturn ; Array: [0]: headers, [1]: received data.
EndFunc
$aReturn = _POSTRequest("www.google.com","/accounts/ClientLogin","accountType=HOSTED_OR_GOOGLE&Email=[MAIL@ADDRESS]&Passwd=[PASSWORD]&service=mail&source=Gulp-CalGulp-1.05", $WINHTTP_FLAG_SECURE)
MsgBox(0, '', $aReturn[0] )
MsgBox(0, '', $aReturn[1] )

OMG!!!

THANK YOU , NOW PROBLEM FIXED.

THANKS SO MUCH , YOU SAVED MY HEAD FROM A COUPLE MORE BUMPS. I WAS SERIOUSLY BANGING MY HEAD AGAINST THE WALL. THANKS FOR YOUR QUICK REPLY. NOW I WILL GO BACK TO SLEEP WITH A CLEAR CONSCIOUS AND THANKS A LOT FOR THE HELP ESPECIALLY THE LADY (TRANCEXX).

I am just trying to develope a youtube uploader with a gmail checker so as soon as am done I will post my project here as a udf so ppl can use my functions for loggin into gmail ,youtube, uploading videos, etc.

Edited by kenunloaded
Link to post
Share on other sites

so i copied your function and tried implementing it on a get function so for some reason when i try adding the line of code Local $aReturn[2]= ['', ''] and everything at the bottom to the _GETRequest it gives me partial html code whenver i do a _GETRequest("www.facebook.com","") but whenever i do my line of code _workingGETRequest("www.facebook.com","") it gives me everything i need. I just need to know how come your way is giving me partial html or not completed html when using it on a get command.

Func _workingGETRequest($domain, $file)
    Local $hOpen, $hConnect, $hRequest
    $hOpen = _WinHttpOpen()
    $hConnect = _WinHttpConnect($hOpen, $domain)
    $hRequest = _WinHttpOpenRequest($hConnect, "GET", $file)
    _WinHttpAddRequestHeaders($hRequest, "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6")
    _WinHttpAddRequestHeaders($hRequest, "Content-Type: application/x-www-form-urlencoded")
    _WinHttpAddRequestHeaders($hRequest, "Connection: Keep-Alive")

    _WinHttpSendRequest($hRequest, $WINHTTP_NO_ADDITIONAL_HEADERS)
    _WinHttpReceiveResponse($hRequest)
    $hResponse = _WinHttpReadData($hRequest)
$header = _WinHttpQueryHeaders($hRequest)
_WinHttpCloseHandle($hRequest)
    _WinHttpCloseHandle($hConnect)
    _WinHttpCloseHandle($hOpen)


    Return $hresponse
EndFunc



Func _GETRequest($domain, $file)
    Local $hOpen, $hConnect, $hRequest
    $hOpen = _WinHttpOpen()
    $hConnect = _WinHttpConnect($hOpen, $domain)
    $hRequest = _WinHttpOpenRequest($hConnect, "GET", $file)
    _WinHttpAddRequestHeaders($hRequest, "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6")
    _WinHttpAddRequestHeaders($hRequest, "Content-Type: application/x-www-form-urlencoded")
    _WinHttpAddRequestHeaders($hRequest, "Connection: Keep-Alive")

    _WinHttpSendRequest($hRequest, $WINHTTP_NO_ADDITIONAL_HEADERS)
    _WinHttpReceiveResponse($hRequest)
    _WinHttpReadData($hRequest)
 
 Local $aReturn[2]= ['', '']
    If _WinHttpQueryDataAvailable($hRequest) Then
        Do

            $aReturn[1] &= _WinHttpReadData($hRequest)

        Until 0=@extended

    EndIf
    $aReturn[0] = _WinHttpQueryHeaders($hRequest)
    _WinHttpCloseHandle($hRequest)
    _WinHttpCloseHandle($hConnect)
    _WinHttpCloseHandle($hOpen)

    Return $aReturn ; Array: [0]: headers, [1]: received data.

EndFunc



$send = _GETRequest("www.facebook.com","")
MsgBox(0, '', $send[1] )
Link to post
Share on other sites

You read some data before starting the loop. This data is discarded since you do not save it to any variable. Just remove it from your Code.

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to post
Share on other sites

I'm gonna update WinHTTP.au3.

ProgAndy, when you find time just check _WinHttpSetOptionEx once again. I'm gonna replace current with that. This seems wrong:

;...
If $sType = "wstr" Then
            $iSize = StringLen($sType) ;<-!!!

And see what to do with _WinHttpQueryOption().

I've gone thru the rest of the UDF and did what needed to be done.

♡♡♡

.

eMyvnE

Link to post
Share on other sites

I modified _WinHTTPSetOption(Ex), so it returns an error if called with an unsupported option. As a result _WinHTTPGetOptionType was removed. Using StringLen for WSTR ist valid.

The length of the buffer is specified in characters for the following options; for all other options, the length is specified in bytes.

* WINHTTP_OPTION_USER_NAME

* WINHTTP_OPTION_PASSWORD

* WINHTTP_OPTION_PROXY_USER_NAME

* WINHTTP_OPTION_PROXY_PASSWORD

* WINHTTP_OPTION_USER_AGENT

; #FUNCTION# ;===============================================================================
;
; Name...........: _WinHttpSetOption
; Description ...: Sets an Internet option.
; Syntax.........: _WinHttpSetOption($hInternet, $iOption, $sSetting)
; Parameters ....: $hInternet - Handle on which to set data.
;                  $iOption - Integer value that contains the Internet option to set.
;                  $vSetting - Value of setting
;                  $iSize    - [optional] Size of $vSetting, required if $vSetting is pointer to memory block
; Return values .: Success - Returns 1.
;                  Failure - Returns 0 and sets @error:
;                  |1 - Invalid Internet option
;                  |2 - Size required
;                  |3 - Datatype of value does not fit to option
;                  |4 - DllCall failed.
; Author ........: trancexx, ProgAndy
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........; http://msdn.microsoft.com/en-us/library/aa384114(VS.85).aspx
; Example .......; Yes
;
;==========================================================================================
Func _WinHttpSetOption($hInternet, $iOption, $vSetting, $iSize=-1)

    If IsBinary($vSetting) Then
        $iSize = DllStructCreate("byte[" & BinaryLen($vSetting) & "]")
        DllStructSetData($iSize, 1, $vSetting)
        $vSetting = $iSize
        $iSize = DllStructGetSize($vSetting)
    EndIf

    Local $sType
    Switch $iOption
        Case $WINHTTP_OPTION_AUTOLOGON_POLICY, $WINHTTP_OPTION_CODEPAGE, $WINHTTP_OPTION_CONFIGURE_PASSPORT_AUTH, $WINHTTP_OPTION_CONNECT_RETRIES, _
            $WINHTTP_OPTION_CONNECT_TIMEOUT, $WINHTTP_OPTION_DISABLE_FEATURE, $WINHTTP_OPTION_ENABLE_FEATURE, $WINHTTP_OPTION_ENABLETRACING, _
            $WINHTTP_OPTION_MAX_CONNS_PER_1_0_SERVER, $WINHTTP_OPTION_MAX_CONNS_PER_SERVER, $WINHTTP_OPTION_MAX_HTTP_AUTOMATIC_REDIRECTS, _
            $WINHTTP_OPTION_MAX_HTTP_STATUS_CONTINUE, $WINHTTP_OPTION_MAX_RESPONSE_DRAIN_SIZE, $WINHTTP_OPTION_MAX_RESPONSE_HEADER_SIZE, _
            $WINHTTP_OPTION_READ_BUFFER_SIZE, $WINHTTP_OPTION_RECEIVE_TIMEOUT, _
            $WINHTTP_OPTION_RECEIVE_RESPONSE_TIMEOUT, $WINHTTP_OPTION_REDIRECT_POLICY, $WINHTTP_OPTION_REJECT_USERPWD_IN_URL, _
            $WINHTTP_OPTION_REQUEST_PRIORITY, $WINHTTP_OPTION_RESOLVE_TIMEOUT, $WINHTTP_OPTION_SECURE_PROTOCOLS, $WINHTTP_OPTION_SECURITY_FLAGS, _
            $WINHTTP_OPTION_SECURITY_KEY_BITNESS, $WINHTTP_OPTION_SEND_TIMEOUT, $WINHTTP_OPTION_SPN, $WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS, _
            $WINHTTP_OPTION_WORKER_THREAD_COUNT, $WINHTTP_OPTION_WRITE_BUFFER_SIZE

            $sType = "DWORD*"
            $iSize = 4
        Case $WINHTTP_OPTION_CALLBACK, $WINHTTP_OPTION_PASSPORT_SIGN_OUT

            $sType = "ptr*"
            $iSize = 4
            If @AutoItX64 Then $iSize = 8
            If Not IsPtr($vSetting) Then Return SetError(3,0,0)
        Case $WINHTTP_OPTION_CONTEXT_VALUE

            $sType = "dword_ptr"
            $iSize = 4
            If @AutoItX64 Then $iSize = 8
        Case $WINHTTP_OPTION_PASSWORD, $WINHTTP_OPTION_PROXY_PASSWORD, $WINHTTP_OPTION_PROXY_USERNAME, $WINHTTP_OPTION_USER_AGENT, $WINHTTP_OPTION_USERNAME
            $sType = "wstr"
            If (IsDllStruct($vSetting) Or IsPtr($vSetting)) Then Return SetError(3,0,0)
            If $iSize < 1 Then $iSize = StringLen($sType)
        Case $WINHTTP_OPTION_CLIENT_CERT_CONTEXT, $WINHTTP_OPTION_GLOBAL_PROXY_CREDS, $WINHTTP_OPTION_GLOBAL_SERVER_CREDS, $WINHTTP_OPTION_HTTP_VERSION, _
            $WINHTTP_OPTION_PROXY
            $sType = "ptr"
            If Not (IsDllStruct($vSetting) Or IsPtr($vSetting)) Then Return SetError(3,0,0)
        Case Else
            Return SetError(1,0,0)
    EndSwitch
    If $iSize < 1 Then
        If IsDllStruct($vSetting) Then
            $iSize = DllStructGetSize($vSetting)
        Else
            Return SetError(2,0,0)
        EndIf
    EndIf

    If IsDllStruct($vSetting) Then
        Local $a_iCall = DllCall("winhttp.dll", "int", "WinHttpSetOption", "handle", $hInternet, "dword", $iOption, $sType, DllStructGetPtr($vSetting), "dword", $iSize)
    Else
        Local $a_iCall = DllCall("winhttp.dll", "int", "WinHttpSetOption", "handle", $hInternet, "dword", $iOption, $sType, $vSetting, "dword", $iSize)
    EndIf
    If @error Or Not $a_iCall[0] Then Return SetError(4, 0, 0)
    Return SetError(0, 0, 1)

EndFunc   ;==>_WinHttpSetOption

_WinHttpQueryOption() seems OK for now :blink:

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...