<%Stime=Timer()%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/htmlcharset=gb2312" />
<title>asp 通过域名查IP</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<table width="528" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="27" align="right"></td>
<td align="center">asp 通过域名查IP</td>
<td></td>
</tr>
<tr>
<td width="96" height="21" align="right">域名:</td>
<td width="288" align="center">
<input name="URL" type="text" id="URL" value="<%=Trim(Request.Form("URL"))%>" size="35" />
<input name="Search" type="hidden" id="Search" value="True" /></td>
<td width="144">
<input type="submit" name="Submit" value="查询" /></td>
</tr>
</table>
</form>
<table width="528" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="64"></td>
<td width="464">
<%
Search=Trim(Request.Form("Search"))
If Search="True" Then
URL=Trim(Request.Form("URL"))
Set objWShell=CreateObject("WScript.Shell")
Set objCmd=objWShell.Exec("ping "&url)
StrPResult=objCmd.StdOut.Readall()
Set objCmd=nothing
Set objWShell=nothing
On Error Resume Next
IP=strCut(StrPResult,"[","]",2)
If Err Then
Err.Clear
IP="<b>此IP未知或域名不可用!</b>"
End if
Response.Write("<b>查询结果</b><br><br>您查询的域名:"&URL&"<br><br>IP地址为:"&IP&"<br>")
'Response.Write("<p>"&Replace(StrPResult,vbCrLf,"<br>"))'输出详细内容
EndTime=Timer()
Response.Write("<br>查询时间共用:"&FormatNumber((EndTime-STime),3,-1)&"</b>秒")
End if
Function strCut(strContent,StartStr,EndStr,CutType)
Dim strHtml,S1,S2
strHtml = strContent
On Error Resume Next
Select Case CutType
Case 1
S1 = InStr(strHtml,StartStr)
S2 = InStr(S1,strHtml,EndStr)+Len(EndStr)
Case 2
S1 = InStr(strHtml,StartStr)+Len(StartStr)
S2 = InStr(S1,strHtml,EndStr)
End Select
If Err Then
strCute = "<p align='center'>没有找到需要的内容。</p>"
Err.Clear
Exit Function
Else
strCut = Mid(strHtml,S1,S2-S1)
End If
End Function
%>
</td>
</tr>
</table>
</body>
</html>
些答案可行
欢迎分享,转载请注明来源:夏雨云
评论列表(0条)