asp检查网址是否可用
asp如何检查某个网址是否有效或者无效(http状态码不为200)
源代码如下
<%
sub checkurl(url)
set xhr=server.CreateObject("Microsoft.XMLHTTP")
xhr.open "GET",url,false
on error resume next
xhr.send
if err<>0 then
response.Write "<font color=red>"&url&"发生错误:"&err.Description&"</font><br/>"
err.Clear
elseif xhr.status=200 then'非200状态全部判断为无效
response.Write "<font color=green>"&url&"可用</font><br/>"
else
response.Write "<font color=red>"&url&"无效"&xhr.status&"</font><br/>"
end if
set xhr=nothing
on error goto 0
end sub
checkurl "http://www.baidu.com/"
checkurl "http://www.youku.com/"
%>
加支付宝好友偷能量挖...

原创文章,转载请注明出处:asp检查网址是否可用
