30. august 2006 - 12:01
#3
Så er det jo ret meget lige til.. Du laver connection til databasen, udskriver de urls der skal kontrolleres i et array og kontrollerer dem. Og du skal nok lige have tilføjet et script timeout :)
<%
For each loop ....
\/ \/ \/ \/ \/ \/ \/ \/
arrURLS = arrURLS & Record("url") & ","
End loop ....
arrURLS = Split(arrURLS,",") - 1
' Array med HTTP header koder
arrHTTPcode = Array("100", "101", "200", "201", "202", "203", "204", "205", "206", "300", "301", "302", "303", "304", "305", "307", "400", "401", "402", "403", "404", "405", "406", "407", "408", "409", "410", "411", "412", "413", "414", "415", "416", "417", "500", "501", "502", "503", "504", "505")
' Array med HTTP header kodernes forklaringer
arrHTTPtext = Array("Continue", "Switching Protocols", "OK", "Created", "Accepted", "Non-Authoritative Information", "No Content", "Reset Content", "Partial Content", "Multiple Choices", "Moved Permanently", "Found", "See Other", "Not Modified", "Use Proxy", "Temporary Redirect", "Bad Request", "Unauthorized", "Payment Required", "Forbidden", "Not Found", "Method Not Allowed", "Not Acceptable", "Proxy Authentication Required", "Request Time-out", "Conflict", "Gone", "Length Required", "Precondition Failed", "Request Entity Too Large", "Request-URI Too Large", "Unsupported Media Type", "Requested range not satisfiable", "Expectation Failed", "Internal Server Error", "Not Implemented", "Bad Gateway", "Service Unavailable", "Gateway Time-out", "HTTP Version not supported")
' Gennemløb Array med URL'er
For intURL = 0 to Ubound(arrURLS)
Set HttpObj = Server.CreateObject("AspHTTP.Conn")
HTTPObj.Url = arrURLS(intURL)
HTTPObj.GetURL
For intCode = 0 to Ubound(arrHTTPcode)
If Instr(HttpObj.Response,arrHTTPcode(intCode)) Then
strResponse = arrHTTPtext(intCode)
Exit For
End if
Next
Response.Write "<p>" & arrURLS(intURL) & " - " & strResponse & "</p>"
strResponse = ""
Next
%>