测试url可用性的脚本
========================================
测试url可用性 TestUrl.vbe
Used: cscript TestUrl.vbe url
Code by haicao E.S.T
========================================On Error Resume Next
HELP()
If Wscript.Arguments.Count <>1 Then
Wscript.echo "参数有误!"
Wscript.Quit
end if
strURL = wscript.arguments(0)Wscript.Echo("URL: " & strURL & " 页面状态:" &TestUrl(strURL))
==============================================================================
function TestUrl(byval strURL)
on error resume next
Set objHTTP = CreateObject("MSXML2.XMLHTTP")
objHTTP.Open "GET", strURL, FALSE
objHTTP.Send
TestUrl=objHTTP.statusText
end function
sub HELP()
WSCRIPT.ECHO "========================================"
wscript.echo " 测试url可用性 TestUrl.vbe "
wscript.echo " Used: cscript TestUrl.vbe url"
wscript.echo " Code by haicao E.S.T"
WSCRIPT.ECHO "========================================"
end sub
==============================================================================<%strURL = request("url")%>
<html><title>测试url可用性</title>
<body>
<form>
<input name=url type=text value="<%=strURL%>">
<input name=check1 type=submit value="查询有效性">
</form>
<%
On Error Resume Next
if strURL<>"" then
Set objHTTP = CreateObject("MSXML2.XMLHTTP")
objHTTP.Open "GET", strURL, FALSE
objHTTP.Send
if instr(objHTTP.statusText,"OK") then
response.write "测试的url: " & strURL &" 有效!返回状态:" &objHTTP.statusText
else
response.write "测试的url: " & strURL &" 返回状态:" &objHTTP.statusText
end if
end if
%>
</body>
</html>
补充:综合编程 , 安全编程 ,