|
这是我昨天写的一个片断,给你参考,希望有帮助
Dim url : url="http://10.100.116.202/web"
Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
Dim Stream :Set Stream = fso.OpenTextFile("c:\result.txt",2)
check url
Private Function check(url)
Set xmlhttp_obj = createobject("microsoft.xmlhttp")
xmlhttp_obj.open "get",url,False
xmlhttp_obj.send
MsgBox xmlhttp_obj.readystate &xmlhttp_obj.status
If xmlhttp_obj.readystate <> 4 Then
MsgBox xmlhttp_obj.readstate
Else
If xmlhttp_obj.status>=200 And xmlhttp_obj.status<300 Then
Stream.writeline url&" valided"
content=xmlhttp_obj.responsetext
'MsgBox content
Set re = New RegExp
re.Pattern = "<A HREF\=\D?(\/[a-z]+)+"
re.Global = True
re.IgnoreCase = True
Set matches = re.execute(content)
For each match in matches
cutstring=Right(match,match.length-13)
newurl=url&cutstring
MsgBox Newurl
check Newurl
Next
End If
End If
End Function |
|