karlkar Posted September 4, 2013 Share Posted September 4, 2013 (edited) Hello! My problem is that I have proxy set. In Internet Explorer I have set "Use automatic configuration script". My code is: #include <WinHttp.au3> Local $response = "" Local $arr = _WinHttpGetIEProxyConfigForCurrentUser() _ArrayDisplay($arr) Local $hOpen = "" If $arr[1] <> '' Then $response &= 'I am here!' & @CRLF $hOpen = _WinHttpOpen(Default, $WINHTTP_ACCESS_TYPE_NAMED_PROXY, $arr[1]) ElseIf $arr[2] <> '' Then $hOpen = _WinHttpOpen(Default, $WINHTTP_ACCESS_TYPE_NAMED_PROXY, $arr[2]) Else $hOpen = _WinHttpOpen() EndIf If $hOpen == 0 Then $response &= "OpenRequest failed" & @CRLF EndIf Local $hConnect = _WinHttpConnect($hOpen, "address.pl") If $hConnect == 0 Then $response &= "Open failed" & @CRLF EndIf Local $hRequest = _WinHttpOpenRequest($hConnect, "POST", "rest/api/2/search") If $hRequest == 0 Then $response &= "OpenRequest failed" & @CRLF EndIf $response &= "SetCredentials = " & _WinHttpSetCredentials($hRequest, $WINHTTP_AUTH_TARGET_SERVER, $WINHTTP_AUTH_SCHEME_BASIC, "login", "pass") & @CRLF ; getting response from server and pasting it to clipboard $response &= "SendRequest = " & _WinHttpSendRequest($hRequest, "Content-Type: application/json", '{"jql":"cf[10201] ~ zupa"}') & @CRLF MsgBox(0, "", $response) It displays the array correctly - arr[0] = 0, arr[1] = 'address_to_script', arr[2] = '', arr[3] = '' However the last message box shows I am here! SetCredentials = 1 SendRequest = 0 How should I handle auto-configuration script for request to be sent? Is there any way to execute the script and obtain the correct proxy URL? Edited September 4, 2013 by karlkar Link to comment Share on other sites More sharing options...
nicero Posted February 23, 2015 Share Posted February 23, 2015 ; Gets proxy settings from Windows registry #include <MsgBoxConstants.au3> Local $sProxyServer = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer") Local $sProxyOverride = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyOverride") MsgBox($MB_SYSTEMMODAL, "Proxy", $sProxyServer & @CRLF & $sProxyOverride) 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