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!

importing web page 1

Status
Not open for further replies.

BlindPete

Programmer
Jul 5, 2000
711
1
0
US
Hello,

I am doing some charity work with ASP classic, and I'm a bit rusty. What I am doing is importing a web page from a volunteers personal page into the charity's website. However the page comes up "not found". If I test with other urls like google.com it works fine.

Do you suppose the host is blocking the MSXML2.ServerXMLHTTP object?

Code:
Function getURL(url)
    set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") 
    xmlhttp.open "GET", url, false 
    xmlhttp.send "" 
    getURL2 = xmlhttp.responseText 
    set xmlhttp = nothing 
End Function

url = "[URL unfurl="true"]http://web.me.com/sundog_dave/K9_Karnival_2009/Home.html"[/URL]
webpage = getURL(url)
if webpage = "" then webpage = url
Response.write "<BASE HREF='" & url & "'>"
Response.Write( webpage )

-Pete
Games the old fashion way with Dice, Paper and Pencils!
 
I can't test this from work, but what exactly is the error message you are getting? Is it a connection issue (i.e. "A connection with the server could not be established") or simply a "page not found" issue?

One thing I did notice was the base href tag - it should not include the file name, rather just the url + path, so try something like this:

Code:
[b]
pathName = "[URL unfurl="true"]http://web.me.com/sundog_dave/K9_Karnival_2009/"[/URL]
pageName = "Home.html"
url = pathName & pageName
[/b]
webpage = getURL(url)
if webpage = "" then webpage = url
Response.write "<BASE HREF='" & [b]pathName[/b] & "'>"
Response.Write( webpage )



--------
GOOGLE is a great resource to find answers to questions like "how do i..."

If you don't know exaclty what you want to do or what to search on, try Google Suggest: --------
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javasc
 
thank you. I will try that, but the error occurs before i get to that point.

the message is 404 page not found.

I thought maybe the target's robots.txt might be excluding calls like this. I don't know how to fake a different request header... not sure I really want to do that anyhow.

-Pete
Games the old fashion way with Dice, Paper and Pencils!
 
Another thing I noticed is that in your function you are returning "GETURL2" where your function is set as "GETURL"

I actually tried this on my own webserver, and have a demo working there - here is my exact code + link to the page


Code:
<%
Function getURL(url)
    set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") 
    xmlhttp.open "GET", url, false 
    xmlhttp.send "" 
    getURL = xmlhttp.responseText 
    set xmlhttp = nothing

End Function

url = "[URL unfurl="true"]http://web.me.com/sundog_dave/K9_Karnival_2009/"[/URL]
webpage = getURL(url & "Home.html")
if webpage = "" then webpage = url
Response.write "<BASE HREF='" & url & "'>"
Response.Write( webpage )
%>

--------
GOOGLE is a great resource to find answers to questions like "how do i..."

If you don't know exaclty what you want to do or what to search on, try Google Suggest: --------
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javasc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top