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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

winhttp script works on 2000 but not on XP or server 2003

Status
Not open for further replies.

wciccadmin

Programmer
Jan 26, 2006
17
US
Hello,

I have a vbs that uses winhttp to copy the contents of a web page to a local text file on a windows 2000 server.

It runs fine on the 2000 server but I tried running it from my XP workstation and a 2003 server and the script will not run.

The error I get is

ActiveX component can't create object: "WinHTTP.WinHTTPRequest.5"


I checked and the winhttp.dll is on my xp and 2003 machine and both are registered properly.

Any ideas as to what I am missing...

here is the code in its simpliest form, just grabbing the contents of a single page and displaying it as a message box... it runs fine on the 2000 machine, but not on XP or 2003 server.


--------

Dim objWinHttp
Dim strHTML

Set objWinHttp = CreateObject("WinHttp.WinHttpRequest.5")

objWinHttp.Open "GET", "objWinHttp.Send

strHTML = objWinHttp.ResponseText

msgbox strHTML

Set objWinHttp = Nothing

------------


any ideas why it will not run on xp or 2003 server?
 
For XP you need to change:

[tt]Set objWinHttp = CreateObject("WinHttp.WinHttpRequest.5")
[/tt]

to

[tt]Set objWinHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
[/tt]

I'm not sure what version you need for Server 2003.



Hope this helps.

[vampire][bat]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top