28,401
社区成员
发帖
与我相关
我的任务
分享
Function GetHttpPage(HttpUrl)
Set Http=server.createobject("MSX"&"ML2.XML"&"HTTP")
Http.open "GET",HttpUrl,False
Http.Send()
If Http.Readystate<>4 and Http.status<>200 then
Set Http=Nothing
Exit function
End if
Set ore = New RegExp
ore.Pattern = "<meta[^>]+charset=[""]?([\w\-]+)[^>]*>"
ore.Global = True
ore.IgnoreCase = True
Set Matches = ore.execute(Http.responseText)
If(Matches.count>0)Then
GetHTTPPage=bytesToBSTR(Http.responseBody,Matches(0).submatches(0))
Else
'GetHTTPPage=Http.responseText '没有找到编码则不转换编码
GetHTTPPage=bytesToBSTR(Http.responseBody,"gb2312") '没有找到编码则转换为GB2312
End if
Set Http=Nothing
End Function