VB+XMLHTTP 如何不断更新服务器返回的时间
答案:2 悬赏:40 手机版
解决时间 2021-03-29 01:17
- 提问者网友:寂寞撕碎了回忆
- 2021-03-28 06:30
VB+XMLHTTP 如何不断更新服务器返回的时间
最佳答案
- 五星知识达人网友:duile
- 2021-03-28 07:47
Utf-8好像可以这样用
Option Explicit
Function GetBody(Url)
Dim ObjXML
Set ObjXML = CreateObject("Microsoft.XMLHTTP")
With ObjXML
.Open "Get", Url, False, "", ""
.SEnd
GetBody = .ResponseBody
End With
GetBody = BytesToBstr(GetBody, "UTF-8")
Set ObjXML = Nothing
End Function
Function BytesToBstr(strBody, CodeBase)
Dim ObjStream
Set ObjStream = CreateObject("Adodb.Stream")
With ObjStream
.Type = 1
.Mode = 3
.Open
.Write strBody
.Position = 0
.Type = 2
.Charset = CodeBase
BytesToBstr = .ReadText
.Close
End With
Set ObjStream = Nothing
End Function
Private Sub Form_Load()
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Dim strHTML As String
strHTML = GetBody("http://localhost/1.asp")
MsgBox strHTML
End Sub参考资料:vb吧
Option Explicit
Function GetBody(Url)
Dim ObjXML
Set ObjXML = CreateObject("Microsoft.XMLHTTP")
With ObjXML
.Open "Get", Url, False, "", ""
.SEnd
GetBody = .ResponseBody
End With
GetBody = BytesToBstr(GetBody, "UTF-8")
Set ObjXML = Nothing
End Function
Function BytesToBstr(strBody, CodeBase)
Dim ObjStream
Set ObjStream = CreateObject("Adodb.Stream")
With ObjStream
.Type = 1
.Mode = 3
.Open
.Write strBody
.Position = 0
.Type = 2
.Charset = CodeBase
BytesToBstr = .ReadText
.Close
End With
Set ObjStream = Nothing
End Function
Private Sub Form_Load()
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Dim strHTML As String
strHTML = GetBody("http://localhost/1.asp")
MsgBox strHTML
End Sub参考资料:vb吧
全部回答
- 1楼网友:孤老序
- 2021-03-28 07:59
好难呢?
看不懂
祝你成功吧1
看不懂
祝你成功吧1
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯