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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

url checking / validating

Status
Not open for further replies.

craigey

Technical User
Apr 18, 2002
510
GB
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
'*********************
Code:
    <%
    strFrom=request.form(&quot;result&quot;)
    strResult=request.form(&quot;url&quot;)
    %>
    <HTML>
    <HEAD>
    <TITLE>URL check</TITLE>
    </HEAD>
    <BODY>
    <FORM method=&quot;post&quot; action=&quot;checkurl.asp&quot;>
    <P><INPUT type=&quot;text&quot; name=&quot;url&quot;></P>
    <P><INPUT type=&quot;submit&quot; value=&quot;submit&quot; name=&quot;submit&quot;></P>
    </FORM>
    <P><%= strFrom %></P>
    <P><%= strResult %></P>
    </BODY>
    </HTML>


'****** checkurl.asp ****
'part 2: the actual check
'************************
Code:
    <%
    strURL=request.form(&quot;url&quot;)
    if strURL<>&quot;&quot; Then
    if left(lcase(strURL),7)<>&quot;[URL unfurl="true"]http://&quot;[/URL] Then
    strURL=&quot;[URL unfurl="true"]http://&quot;[/URL] & strURL
    End if
    On Error Resume Next
    Dim objhttp
    Dim sHTML
    Set objhttp = Server.CreateObject (&quot;Microsoft.XMLhttp&quot;)
    objhttp.open &quot;GET&quot;, strURL, False
    objhttp.send
    sHTML=objhttp.statusText
    if err or sHTML<>&quot;OK&quot; Then
    sTxt=&quot;fail&quot;
    else
    sTxt=&quot;ok&quot;
    End if
    Set objhttp=nothing
    else
    sTxt=&quot;fail&quot;
    End if
    strFrom=request.ServerVariables(&quot;http_REFERER&quot;)
    p=instr(1,strFrom,&quot;?&quot;)
    if p>0 Then
    strFrom=left(strFrom,p-1)
    End if
    response.redirect &quot;checkdone.asp?result=&quot; & sTxt & &quot;&ref=&quot; & strURL & &quot;&return=&quot; & strFrom
    %>

'****** checkdone.asp ****
'part 3: post the results back to the re
' ferer
'************************
Code:
    <%
    strRes=request.querystring(&quot;result&quot;)
    strRef=request.querystring(&quot;ref&quot;)
    strRet=request.querystring(&quot;return&quot;)
    %>
    <HTML>
    <HEAD>
    </HEAD>
    <SCRIPT>
    function postit(){
    myform.submit();
    }
    </SCRIPT>
    <BODY onLoad=&quot;postit()&quot;>
    <FORM method=&quot;post&quot; action=&quot;<%= strRet %>&quot; name=&quot;myform&quot;>
    <INPUT type=&quot;hidden&quot; name=&quot;result&quot; value=&quot;<%= strRes %>&quot;>
    <INPUT type=&quot;hidden&quot; name=&quot;url&quot; value=&quot;<%= strRef %>&quot;>
    </FORM>
    </BODY>
    </HTML>


Please please help!

Thanks!
 
You might want to move this to the regular asp forum, this is the asp.net forum. The people monitoring the other forum are probably more familiar and current with classic asp, while some people like me on this forum haven't touched classic asp for a while.

Crystal
crystalized_s@yahoo.com

--------------------------------------------------

Experience is one thing you can't get for nothing.

-Oscar Wilde

 
cheers for the reply, I Have already posted this on the other forum, but because I got no response posted it here as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top