VB XMLHTTP運用辦法。本站提示廣大學習愛好者:(VB XMLHTTP運用辦法)文章只能為提供參考,不一定能成為您想要的結果。以下是VB XMLHTTP運用辦法正文
Private Function IsHearOK(URL As String) As Boolean
Dim XMLObject As Object, ReturnType As String
Set XMLObject = 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
If XMLObject.Status = 200 Or XMLObject.Status = 206 Then
ReturnType = XMLObject.getResponseHeader("CONTENT-TYPE")
If UCase(ReturnType) <> "TEXT/HTML" Then
IsHearOK = True
Else
IsHearOK = False
End If
Else
IsHearOK = False
End If
Set XMLObject = Nothing
End Function
Private Sub Command1_Click()
If IsHearOK("http://www.jb51.net/test.exe") Then
MsgBox "ok"
Else
MsgBox "no"
End If
End Sub