抓取gzip压缩网页乱码问题
请教asp抓取gzip网页乱码,怎么解压缩,要asp的
Function GetHttpPage(HttpUrl,webCset)
If IsNull(HttpUrl)=True Or Len(HttpUrl)<18 Or HttpUrl="$False$" Then
GetHttpPage="$False$"
Exit Function
End If
HttpUrl=replace(HttpUrl,"&","&")
If webCset="" then
webCset="gb2312"
end if
Dim Http
Set Http=server.createobject("MSXML2.XMLHTTP")
Http.open "GET",HttpUrl,False
'http.setRequestHeader "Accept-Encoding:", "compress"
Http.Send()
If Http.Readystate<>4 then
Set Http=Nothing
GetHttpPage="$False$"
Exit function
End if
If InStr(LCase(Http.getResponseHeader("Content-Encoding")), "gzip") > 0 Then
‘加压缩gzip
end if
GetHTTPPage=bytesToBSTR(Http.responseBody,webCset)
Set Http=Nothing
If Err.number<>0 then
Err.Clear
End If
End Function