Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XMLHTTP

Status
Not open for further replies.

BoostMR2

IS-IT--Management
Jul 20, 2007
33
0
0
US
Hi guys, I am using XMLHTTP object to send an http request. I want to send the HTTP request using different proxies, so I made a sub that is called and passed different proxy server names to test.

sub testSite(url, proxy)
Set objHTTP = CreateObject("MSXML2.XMLHTTP")
objHTTP.open "GET", url, false
objHTTP.send
msgbox objHTTP.responseText
set xmlhttp = nothing
end sub

using the XMLHTTP object, I cannot figure out if there is a way to tell the request to use a specific proxy (like xmlhttp.proxy = proxy). Right now it uses the currently configured proxy settings in IE for the machine that executes the script.

If there isn't a way to specify the proxy to use, it looks like I will have to dynamically change the setting within IE via the registry, but that will be much slower.
 
I think the short answer is no.

This object was meant to be used within a web page, which is why it is dependent on IE's proxy settings.

There is a similar Server object, and its proxy settings can be changed. See IServerXMLHTTPRequest/ServerXMLHTTP Members. This is independent of IE, and is meant for non-browser purposes.

Version-dependent ProgIDs:

Msxml2.ServerXMLHTTP.4.0
Msxml2.ServerXMLHTTP.5.0
Msxml2.ServerXMLHTTP.6.0

Also see: Why Version-Independent GUIDs and ProgIDs Were Removed. What it amounts to is that these components are not intended for general scripting use.
 
Thank you for the additional information. That would make sense, and I am glad there is an object I can use. Basically I just need to send an http request programatically, and it has to use a specific proxy for my test. As long as the Iserver object can accomplish this, I should be ok. I will repost once i get to test this.
 
I wasn;t able to tets this until recently. I am running into a wall here. All of my windows 2000 boxes are running MSXML version 3.0. Apparently 3.0 doesn't support the getProxy method. Only 4.0 does. So I have 1 of 2 options:

a. find a way to include the 4.0 objects needed for getproxy to work (note this has to work if i copy/paste my tools folder to the server and use it. I do not want to go to each server beforehand and install 4.0 manually).

b. say screw it and write this in C# using the included HTTPRequest Method that allows proxy configuration in the code.

Any other ideas for doing this in vbscript are welcome =)
 
Shouldn't it be setProxy instead of getProxy?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top