asp下的一个检测链接是否正常的函数

 更新时间:2008年07月15日 19:26:25   作者:  
很简单的函数,用来检测网站域名是否能正常访问。
Function urlChk(sUrl)
on error resume next
Set xmlHttp = Server.CreateObject("Microsoft.XMLHTTP")
xmlHttp.open "GET",sUrl,false
xmlHttp.send
    if xmlHttp.Status <> 200 then
        urlChk=false
    else
        urlChk=true
    end if
End Function

sUrl="https://www.jb51.net"
if urlChk(sUrl) then
    response.write(sUrl&"(可以正常访问)")
else
    response.write(sUrl&"(访问不了)")
end if

相关文章

最新评论