vb中如何使用Microsoft.XMLHTTP?

lang11zi 2006-02-23 10:57:52
Public Function GetPage(url)
Dim Retrieval
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", url, False
.Send
GetPage = BytesToBstr(.ResponseBody)
End With
Set Retrieval = Nothing
End Function

Public Function BytesToBstr(body)
Dim objstream
Set objstream = CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode = 3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = "GB2312"
BytesToBstr = objstream.ReadText
objstream.Close
Set objstream = Nothing
End Function

这样用对不对啊?

我要读一个网页进去.然后获得页面GetPage
...全文
36148 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
lang11zi 2006-02-24
  • 打赏
  • 举报
回复
已经ok
  • 打赏
  • 举报
回复
用的主要方法就是xmlhttp+stream
  • 打赏
  • 举报
回复
http://rabbit.inu.com.cn/faqdownload.rar

看里面的vb代码,csdn 的faq下载工具,我做的
lang11zi 2006-02-23
  • 打赏
  • 举报
回复
我做在组件中 怎么不执行

在窗体中能执行

7,785

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧