Hi All,
How can I modify the 3 pages shown below to read from a database that contains the names of several websites. And then to output all the results to the checkdone.asp page. So that it would display all 8 results. EG.
WEBSITE STATUS
; OK
; OK
; OK
; Failed
; OK
; OK
; OK
; OK
Also how would i modify the code to e-mail the page name and status if it has failed.
'**************************************
' Assumes:There are 3 pages:
check.asp To post the url and receive the result of the check.
checkurl.asp this page will Do the check
checkdone.asp; this page will post the results back To the referer.
'
'This code is copyrighted and has ' limited warranties.Please see ' ww.Planet-Source-Code.com/xq/ASP/txtCode
' Id.6585/lngWId.4/qx/vb/scripts/ShowCode.
' htm
'**************************************
'****** check.asp ****
'part 1: the post form
'*********************
'****** checkurl.asp ****
'part 2: the actual check
'************************
'****** checkdone.asp ****
'part 3: post the results back to the re
' ferer
'************************
Please please help!
Thanks!
How can I modify the 3 pages shown below to read from a database that contains the names of several websites. And then to output all the results to the checkdone.asp page. So that it would display all 8 results. EG.
WEBSITE STATUS
; OK
; OK
; OK
; Failed
; OK
; OK
; OK
; OK
Also how would i modify the code to e-mail the page name and status if it has failed.
'**************************************
' Assumes:There are 3 pages:
check.asp To post the url and receive the result of the check.
checkurl.asp this page will Do the check
checkdone.asp; this page will post the results back To the referer.
'
'This code is copyrighted and has ' limited warranties.Please see ' ww.Planet-Source-Code.com/xq/ASP/txtCode
' Id.6585/lngWId.4/qx/vb/scripts/ShowCode.
' htm
'**************************************
'****** check.asp ****
'part 1: the post form
'*********************
Code:
<%
strFrom=request.form("result")
strResult=request.form("url")
%>
<HTML>
<HEAD>
<TITLE>URL check</TITLE>
</HEAD>
<BODY>
<FORM method="post" action="checkurl.asp">
<P><INPUT type="text" name="url"></P>
<P><INPUT type="submit" value="submit" name="submit"></P>
</FORM>
<P><%= strFrom %></P>
<P><%= strResult %></P>
</BODY>
</HTML>
'****** checkurl.asp ****
'part 2: the actual check
'************************
Code:
<%
strURL=request.form("url")
if strURL<>"" Then
if left(lcase(strURL),7)<>"[URL unfurl="true"]http://"[/URL] Then
strURL="[URL unfurl="true"]http://"[/URL] & strURL
End if
On Error Resume Next
Dim objhttp
Dim sHTML
Set objhttp = Server.CreateObject ("Microsoft.XMLhttp")
objhttp.open "GET", strURL, False
objhttp.send
sHTML=objhttp.statusText
if err or sHTML<>"OK" Then
sTxt="fail"
else
sTxt="ok"
End if
Set objhttp=nothing
else
sTxt="fail"
End if
strFrom=request.ServerVariables("http_REFERER")
p=instr(1,strFrom,"?")
if p>0 Then
strFrom=left(strFrom,p-1)
End if
response.redirect "checkdone.asp?result=" & sTxt & "&ref=" & strURL & "&return=" & strFrom
%>
'****** checkdone.asp ****
'part 3: post the results back to the re
' ferer
'************************
Code:
<%
strRes=request.querystring("result")
strRef=request.querystring("ref")
strRet=request.querystring("return")
%>
<HTML>
<HEAD>
</HEAD>
<SCRIPT>
function postit(){
myform.submit();
}
</SCRIPT>
<BODY onLoad="postit()">
<FORM method="post" action="<%= strRet %>" name="myform">
<INPUT type="hidden" name="result" value="<%= strRes %>">
<INPUT type="hidden" name="url" value="<%= strRef %>">
</FORM>
</BODY>
</HTML>
Please please help!
Thanks!