Solved

Get contents from other web site

Posted on 2014-01-23
9
430 Views
Last Modified: 2014-02-05
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,
0
Comment
Question by:ttta83
  • 4
  • 4
9 Comments
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 39805101
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?
0
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
ID: 39805422
Are you sure this is on your server? MSXML2.ServerXMLHTTP.6.0

Try

url="http://www.cpms.osd.mil/WageData/wagedata"
 Set xmlHttp =  Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
    xmlHttp.Open "GET", url, False
    xmlHttp.setRequestHeader "User-Agent", "asp httprequest"
    xmlHttp.setRequestHeader "content-type", "application/x-www-form-urlencoded"
    xmlHttp.Send
    getHTML = xmlHttp.responseText
  set xmlHttp = Nothing
response.write getHtml

Open in new window

or
url="http://www.cpms.osd.mil/WageData/wagedata"
 Set xmlHttp =  Server.CreateObject("MSXML2.ServerXMLHTTP")
    xmlHttp.Open "GET", url, False
    xmlHttp.setRequestHeader "User-Agent", "asp httprequest"
    xmlHttp.setRequestHeader "content-type", "application/x-www-form-urlencoded"
    xmlHttp.Send
    getHTML = xmlHttp.responseText
  set xmlHttp = Nothing
response.write getHtml

Open in new window

0
 

Author Comment

by:ttta83
ID: 39806618
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.
0
 

Author Comment

by:ttta83
ID: 39806627
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,
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39806662
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

0
 

Author Comment

by:ttta83
ID: 39806764
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!.
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39806816
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

0
 

Author Comment

by:ttta83
ID: 39837264
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!
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39837516
Thank you for the update.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
The viewer will learn how to dynamically set the form action using jQuery.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now