PrivateFunctionIsHearOK(URLAsString)AsBoolean
DimXMLObjectAsObject,ReturnTypeAsString
SetXMLObject=CreateObject("Microsoft.XMLHTTP")
XMLObject.Open"GET",URL,False
XMLObject.setRequestHeader"CONTENT-TYPE","application/x-www-form-urlencoded"
XMLObject.setRequestHeader"Range","bytes=1-255"
XMLObject.Send
IfXMLObject.Status=200OrXMLObject.Status=206Then
ReturnType=XMLObject.getResponseHeader("CONTENT-TYPE")
IfUCase(ReturnType)<>"TEXT/HTML"Then
IsHearOK=True
Else
IsHearOK=False
EndIf
Else
IsHearOK=False
EndIf
SetXMLObject=Nothing
EndFunction
PrivateSubCommand1_Click()
IfIsHearOK("http://www.jb51.net/test.exe")Then
MsgBox"ok"
Else
MsgBox"no"
EndIf
EndSub
【VB XMLHTTP使用方法】相关文章:
★ VB语言使用ADO连接、操作SQLServer数据库教程
★ VB6实现连接Access数据库的ADODB代码实现方法
★ VB的32位程序在64位系统中出现文件和注册表自动转向的解决方法