trancexx Posted August 4, 2010 Author Share Posted August 4, 2010 And it works in your browser when you open http://127.0.0.1/test.html? ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
kenunloaded Posted August 4, 2010 Share Posted August 4, 2010 (edited) 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 August 4, 2010 by kenunloaded Link to comment Share on other sites More sharing options...
kenunloaded Posted August 4, 2010 Share Posted August 4, 2010 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 comment Share on other sites More sharing options...
trancexx Posted August 4, 2010 Author Share Posted August 4, 2010 First thing to spot is you using "Accept-Encoding: gzip,deflate". Where do you decompress data you receive? Lose that line. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
kenunloaded Posted August 4, 2010 Share Posted August 4, 2010 (edited) 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 August 4, 2010 by kenunloaded Link to comment Share on other sites More sharing options...
ProgAndy Posted August 4, 2010 Share Posted August 4, 2010 (edited) 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 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 August 4, 2010 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 comment Share on other sites More sharing options...
kenunloaded Posted August 4, 2010 Share Posted August 4, 2010 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 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 comment Share on other sites More sharing options...
trancexx Posted August 4, 2010 Author Share Posted August 4, 2010 well try it yourself, login with gmail and put your password and it wont login , it will give you bad=authenticationwhich is not true. I tried your function too and it wouldnt work even though when i try to inser the same urlhttp://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/ClientLoginThat 's' actually means something. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
kenunloaded Posted August 4, 2010 Share Posted August 4, 2010 https://www.google.com/accounts/ClientLoginThat 's' actually means something.so what should i do in my code to fix this problem. Link to comment Share on other sites More sharing options...
ProgAndy Posted August 4, 2010 Share Posted August 4, 2010 (edited) 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 August 4, 2010 by ProgAndy duzers 1 *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 comment Share on other sites More sharing options...
trancexx Posted August 4, 2010 Author Share Posted August 4, 2010 (edited) 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 August 4, 2010 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
kenunloaded Posted August 4, 2010 Share Posted August 4, 2010 (edited) 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 August 4, 2010 by kenunloaded Link to comment Share on other sites More sharing options...
motionman95 Posted August 4, 2010 Share Posted August 4, 2010 And it works in your browser when you open http://127.0.0.1/test.html?Yeah, it does. Weird huh? Link to comment Share on other sites More sharing options...
trancexx Posted August 4, 2010 Author Share Posted August 4, 2010 Yeah, it does. Weird huh?No.Write better code. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
motionman95 Posted August 4, 2010 Share Posted August 4, 2010 No.Write better code.So you mean the problem's with my code...? Link to comment Share on other sites More sharing options...
trancexx Posted August 4, 2010 Author Share Posted August 4, 2010 So you mean the problem's with my code...?Could any other conclusion be derived?I have no intention of helping if you have no intention of listening. It gets boring then. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
kenunloaded Posted August 5, 2010 Share Posted August 5, 2010 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. expandcollapse popupFunc _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 comment Share on other sites More sharing options...
ProgAndy Posted August 5, 2010 Share Posted August 5, 2010 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 comment Share on other sites More sharing options...
trancexx Posted August 5, 2010 Author Share Posted August 5, 2010 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 comment Share on other sites More sharing options...
ProgAndy Posted August 5, 2010 Share Posted August 5, 2010 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 expandcollapse popup; #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 *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 comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now