28,376
社区成员




函数名:GetResStr
'作用:获取指定URL的HTML代码
'参数:URL-要获取的URL
function GetResStr(URL)
err.clear
dim ResBody,ResStr,PageCode,ReturnStr
Set Http=server.createobject("msxml2.serverxmlhttp.3.0") '先创建一个serverxmlhttp对像.并指明他是3.0版本的..可以省去
Http.setTimeouts 10000, 10000, 10000, 10000 '设置超时时间
Http.open "GET",URL,False '以上已设置后。就打开网址。参数1:提交方式,url地址,异步执行 一般选择异步执行
Http.Send() '调用Send方法发送XML数据
If Http.Readystate =4 Then '文档已经解析完毕,客户端可以接受返回消息
If Http.status=200 Then '接收返回的错误
ResStr=http.responseText '接收返回的信息..(源代码一般)
ResBody=http.responseBody '以html方式返回消息
PageCode=GetCode(ResStr,reg) '用正则表达式。将网站返回的title值进行匹配。如果有就返回。。否则返回gbk2312
ReturnStr=BytesToBstr(http.responseBody,PageCode) '需要将其转换一下..
GetResStr=ReturnStr '返回值
End If
vUrl="http://www.hyiii.com" '支付后跳转地址
End If
End Function