?
Solved

SCREEN SCRAPE WITHIN SAME DOMAIN?

Posted on 2003-12-04
3
Medium Priority
?
349 Views
Last Modified: 2010-05-18
Hi experts,

I am trying to use the Microsoft.XMLHTTP object in asp to screen scrape a page with my domain from another page within my domain.

It doesn't seem to work although if I scrape a page from another doamin it works fine. Do any of you know if it is impossible to use this object in order to scrape a page from within the same domain or does my code need modification.

Any comments would be appreciated.


My code is as follows:

Dim objXML

Set objXML = Server.CreateObject("Microsoft.XMLHTTP")
strURL ="testPage.asp"
objXML.Open "GET" , strURL , False ,"",""
objXML.Send

If Err.Number = 0 Then                  'no errors
If objXML.Status = 200 then            'url is valid
strOpen = objXML.ResponseText

response.write(strOpen)

Else
Response.Write "Incorrect URL"
End if
Else
Response.Write Err.Description
End If

Set objXML = Nothing





PJORDANNA
0
Comment
Question by:pjordanna
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:pjordanna
ID: 9876073
I've also tried it with an absolute URL.


PJORDANNA
0
 
LVL 26

Accepted Solution

by:
rdcpro earned 1500 total points
ID: 9878194
This is the old XMLHTTPRequest object from the old version 2 parser.  Don't use it on the server!  This is very important, since the old version was not server-safe.  Use instead:

Set objXML = Server.CreateObject("Msxml2.ServerXMLHTTP")


It has to be an absolute URL...this code works on my machine:

<%@ Language=VBScript %>
<%

Dim objXML

Set objXML = Server.CreateObject("Msxml2.ServerXMLHTTP")
strURL ="http://localhost/sandbox/default.htm"

objXML.Open "GET", strURL , false

objXML.Send

If Err.Number = 0 Then               'no errors
If objXML.Status = 200 then          'url is valid
strOpen = objXML.ResponseText

response.write(strOpen)

Else
Response.Write "Incorrect URL"
End if
Else
Response.Write Err.Description
End If

Set objXML = Nothing

%>


Regards,
Mike Sharp

0
 

Author Comment

by:pjordanna
ID: 9880813
Hi Mike,

I actually got it working last night but thanks for the info about the new version of XMLHTTP. I have implemented this new version as a replacement.





PJORDANNA
0

Featured Post

CHALLENGE LAB: Troubleshooting Connectivity Issues

Goal: Fix the connectivity issue in the lab's AWS environment so that you can SSH into the provided EC2 instance.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

764 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