what am I doing wrong.....

G

Graham Mattingley

Hello

I have this coden (below), that I found that works really well when to prove
a URL is valid, or any object in a URL. They way it works is that you submit
the URL through a form, txtURL is the varable...

What I want to be able to do is have a database of URLs and loop through
them with this in the middle and check all the URLs I have on my database..

so I did

txtURL=rsIslandinfo("URL").Value --- (my database varable)

the whole page loads in about 2 seconds, and all the URL have tested as
invalid, I suspect the value txtURL is not being applyed to the XMLHTTP
object..

any ideas, I wanted to test my database of links are up to date

Regards

Graham Mattingley



if len(trim(Request("txtURL"))) > 0 then
iStatus = 0
sURL = trim(Request("txtURL"))
'Set obj = CreateObject("Microsoft.XMLHTTP")
Set obj = CreateObject("MSXML2.XMLHTTP.4.0")
on error resume next
obj.open "GET", sURL, False
obj.send
if err.number = 0 then
iStatus = obj.Status
end if
on error goto 0

if iStatus = 200 then
Response.write "<p>The URL is valid, status is " & iStatus & "</p>" & vbCRLF
else
Response.write "<p>The URL is invalid, status is " & iStatus & "</p>" &
vbCRLF
end if
end if
 
T

Tom B

Try taking out your on error resume next.
You have an if statement that's keeping iStatus from getting a value.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top