Link to home
Start Free TrialLog in
Avatar of ttta83
ttta83

asked on

Get contents from other web site

I need to get contents from other web site a display it on the screen.  I have the following code:

dim url, xmlhttp
    url = "http://www.cpms.osd.mil/WageData/wagedata"
    set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP.6.0")
     xmlhttp.open "GET", url, false
    xmlhttp.setRequestHeader "Content-Type", "text/HTML"
   xmlhttp.Send
   
        Response.write (xmlhttp.responseText)
    set xmlhttp = nothing


I'm getting this error:

We have encountered an error on this page.  
 
An 500;100 ASP Error encountered.

Error (-2147012867): A connection with the server could not be established
 
It looks like it's because the firewall.  Is there a way to get around it or if there's another way to display data from other web page?

Thanks,
Avatar of Rainer Jeschor
Rainer Jeschor
Flag of Germany image

Hi,
I think this is not the connection/firewall because you get a response - an IIS error 500.
What happens if you copy that URL and open e.g. Internet Explorer on the server where you host your ASP web site and open that url? You probably should get the same result.
Is there a difference when you open that url in your local browser?
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ttta83
ttta83

ASKER

Rainer Jeschor,

I got "The page cannot be displayed" when I tried to open the URL in IE on the server.  It works fine in my local browser.
Avatar of ttta83

ASKER

Scott Fell,

I checked regedit and MSXML2.ServerXMLHTTP.6.0 is on the server.

I tried both of your examples and got the same error:

     An 500;100 ASP Error encountered.
     Error (-2147012867): A connection with the server could not be established

I tried them on different web and got this:

     msxml3.dll error '80072efd'
     A connection with the server could not be established

However both work in my personal web (host by GoDaddy).  

Thanks,
I just tested this on my server and it worked.

if it is not working, are you sure classic asp is turned on?

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
Dim aRequest
Set aRequest = CreateObject ("Microsoft.XMLHTTP")
aRequest.Open "GET","http://www.cpms.osd.mil/WageData/wagedata",False
aRequest.Send
response.write aRequest.responseText
%>

Open in new window

Avatar of ttta83

ASKER

Scott,

I tested your latest code on the server and got:

  msxml3.dll error '800c0005'
  The system cannot locate the resource specified.

Does it have anything to do with the firewall in my company?  Is there another way to get data from other web page?

Thanks for your help!.
Firewalls and networking is not my expertise.

In a pinch you can frame it.

<style>
iframe{
   width:600px;
   height:500px;
}
</style>
<!-- place below in your body section and style tags in your head section -->
<iframe src="http://www.cpms.osd.mil/WageData/wagedata">Frames are not supported</iframe>

Open in new window

Avatar of ttta83

ASKER

Scott,

The problem is the firewall setting.  

I added the line below and the network team added the exception rule for it to work.

     xmlHttp.setProxy 2, "http=ourdomain:portnumber", ""

Thank you very much for your help!
Thank you for the update.