IfWScript.Arguments.Count<>1Then
WScript.Echo"Example:CScript"&WScript.ScriptName&"www.sohu.com"
WScript.Quit
EndIf
url="http://www.seologs.com/ip-domains.html?domainname="&WScript.Arguments(0)
SetoXMLHttpRequest=CreateObject("Msxml2.XMLHTTP")
oXMLHttpRequest.Open"GET",url,False,False
oXMLHttpRequest.Send
str=oXMLHttpRequest.ResponseText
ipos=instr(str,"<fontface="&Chr(34)&"arial"&Chr(34)&">")
ipend=instr(str,"<->")
str=mid(str,ipos+19,ipend-ipos-139)
str=Replace(str,"<b>","")
str=Replace(str,"</b>","")
str=Replace(str,"<small>","")
str=Replace(str,"</small>","")
str=Replace(str,"</font><fontface="&chr(34)&"arial"&chr(34)&"size="&chr(34)&"-1"&chr(34)&">","")
str=Replace(str,"Found","Found")
iposa=instr(str,"with")
iposb=InStr(str,"1)")
stra=mid(str,iposa,iposb-iposa)
str=replace(str,stra,"lcx")
str=replace(str,"lcx1)","<br>1)")
'wscript.echostr
SetoXMLHttpRequest=Nothing
SetobjExplorer=WScript.CreateObject("InternetExplorer.Application")
objExplorer.Navigate"about:blank"
objExplorer.ToolBar=0
objExplorer.StatusBar=0
objExplorer.Visible=1
objExplorer.height=600
objExplorer.width=500
objExplorer.left=400
objExplorer.resizable=0
objExplorer.Document.Body.InnerHTML=str
objExplorer.document.parentwindow.clipboardData.SetData"text",str
SetobjExplorer=nothing
========================正则:
msg="请输入你要查询的IP或域名:"
IP=Inputbox(msg,"域名查询","www.haiyangtop.net")
IfIP=""ThenIP="www.haiyangtop.net"
url="http://www.seologs.com/ip-domains.html?domainname="&IP&""
Body=getHTTPPage(url)
SetRe=NewRegExp
Re.Pattern="(<fontface=""arial"">[sS]+</font></td></tr></table>)"
SetMatches=Re.Execute(Body)
IfMatches.Count>0ThenBody=Matches(0).value
SetoXMLHttpRequest=Nothing
SetobjExplorer=WScript.CreateObject("InternetExplorer.Application")
objExplorer.Navigate"about:blank"
objExplorer.ToolBar=0
objExplorer.StatusBar=0
objExplorer.Visible=1
objExplorer.height=300
objExplorer.width=400
objExplorer.left=400
objExplorer.resizable=0
objExplorer.Document.Body.InnerHTML=IP&Body
'objExplorer.document.parentwindow.clipboardData.SetData"text",IP&Body
SetobjExplorer=nothing
'函数区
FunctiongetHTTPPage(Path)
t=GetBody(Path)
getHTTPPage=BytesToBstr(t,"GB2312")
EndFunction
FunctionGetBody(url)
OnErrorResumeNext
SetRetrieval=CreateObject("Microsoft.XMLHTTP")
WithRetrieval
.Open"Get",url,False,"",""
.Send
GetBody=.ResponseBody
EndWith
SetRetrieval=Nothing
EndFunction
FunctionBytesToBstr(Body,Cset)
Dimobjstream
Setobjstream=CreateObject("adodb.stream")
objstream.Type=1
objstream.Mode=3
objstream.Open
objstream.WriteBody
objstream.Position=0
objstream.Type=2
objstream.Charset=Cset
BytesToBstr=objstream.ReadText
objstream.Close
Setobjstream=Nothing
EndFunction