in reply to How to Detect HTTP proxy settings automatically in Windows OS?

See / try Scripting Proxy Settings in IE and Firefox, http://cpansearch.perl.org/src/QJZHOU/LWP-UserAgent-ProxyAny-1.02/ProxyAny.pm

sub get_ie_proxy { return "" unless $^O eq 'MSWin32'; my %RegHash; eval 'use Win32::TieRegistry(Delimiter=>"/", TiedHash=>\%RegHash); +'; return get_ie_proxy_with_registry() if $@; my $iekey = $RegHash{"CUser/Software/Microsoft/Windows/CurrentVers +ion/Internet Settings/"} or return ""; my $ie_proxy_enable = $iekey->{"/ProxyEnable"} or return ""; my $ie_proxy_server = $iekey->{"/ProxyServer"} or return ""; my $ie_proxy_no = $iekey->{"/ProxyOverride"}; $_[1]=$ie_proxy_no if defined($ie_proxy_no); return $ie_proxy_enable=~/1$/ ? $ie_proxy_server : ""; }
  • Comment on Re: How to Detect HTTP proxy settings automatically in Windows OS?
  • Download Code

Replies are listed 'Best First'.
Re^2: How to Detect HTTP proxy settings automatically in Windows OS?
by sam_bakki (Pilgrim) on Apr 25, 2012 at 05:14 UTC

    Hi There

    Thanks for the quick reply. Your solution may suite perfectly if Windows user explicitly sets proxy server (and port) in IE.

    But in our organization (and most others too) uses auto configuration proxys (proxy.pac).
    In my Windows 7 machine, Under HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings, I have

    AutoConfigURL = http://apac.nics.nxp.com:8080/proxy.pac

    I thought of parsing this file and get the real proxy but to me Windows APIs looks simple approach (ofcourse if it works :) ) than parsing .pac file.

    Of course, Your suggestion is also needed for me because few windows user set direct proxy server and port in IE settings but most others have auto proxy config scripts.

    So , What is a best way to get proxy information (Like many installers do , Ex: chrome installer) in windows OS?

    Thanks & Regards,
    Bakkiaraj M
    My Perl Gtk2 technology demo project - http://code.google.com/p/saaral-soft-search-spider/ , contributions are welcome.

      I thought of parsing this file and get the real proxy but to me Windows APIs looks simple approach (ofcourse if it works :) ) than parsing .pac file.

      Well, if you put it that way :)

      HTTP::ProxyAutoConfig - use a .pac or wpad.dat file to get proxy information

      HTTP::ProxyPAC - use a PAC (Proxy Auto Config) file to get proxy info