81,092
社区成员
发帖
与我相关
我的任务
分享
IP为传值,如 "文件名.asp?Ip=202.102.134.68"
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
dim body,string_start,string_end,Ip
Ip=request("Ip")
if Ip="" then Ip="202.102.134.68"
body=GetPage("http://www.ip138.com/ips.asp?ip="&IP)
if instr(body,"<li>本站主数据:")>0 then
body=Getmod(body,"<li>本站主数据:","</li>")
response.Write("IP:"& IP & " 来自:" &body)
else
response.Write("IP错误或者没有数据")
end if
Function GetPage(url)
dim Retrieval
Set Retrieval = CreateObject("Microso"&"ft.XM"&"LH"&"TTP")
With Retrieval
.Open "Get", url, False ', "", ""
.Send
GetPage = BytesToBstr(.ResponseBody)
End With
Set Retrieval = Nothing
End Function
Function BytesToBstr(body)
dim objstream
set objstream = Server.CreateObject("ado"&"db.str"&"eam")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = "GB2312"
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
Function Getmod(str, kaishi, jieshu)
'On Error GoTo g
Dim aa, bb, cc
aa = InStr(str, kaishi)
bb = Mid(str, aa, Len(str) - aa)
cc = Mid(str, aa + Len(kaishi), InStr(bb, jieshu) - Len(kaishi))
Getmod = Mid(str, aa + Len(kaishi), InStr(bb, jieshu) - Len(kaishi) - 1)
end Function
%>
</body>
</html>