从网站上获取的数据为GZIP加密的,如何解密?

时间:2022-10-10 20:01:32
从网站上获取的数据为GZIP加密的,如何解密?
我用网上的ZLIB.DLL解密函数解不出正确的结果,应该如何处理?

6 个解决方案

#1


GZIP可能也有很多种,多找几种试试吧

#2


mark

#3


http://msdn2.microsoft.com/zh-cn/library/system.io.compression.gzipstream(VS.80).aspx

#4


简单,你发送的GET请求中,不要使用Accept-Encoding

#5


    Set XMLHTTP = CreateObject("MSXML2.xmlhttp")
    With XMLHTTP
        .Open "GET", geturl, False
         'we need to setrequestheaders twice due to KB article Q234486.
'        .setRequestHeader "Cookie", "x=y"
        .setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"
        .setRequestHeader "Referer", strReferer
        .setRequestHeader "accept-language", strLang
        .setRequestHeader "content-type", ""
        .setRequestHeader "content-length", ""
        .setRequestHeader "accept-encoding", "gzip, deflate"
        .setRequestHeader "accept", "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*"
        .send
    End With
    
    XmlGetData = BytesToBstr(getbody, "gb2312")

Public Function BytesToBstr(strBody, CodeBase)
    Dim objStream
    Set objStream = CreateObject("Adodb.Stream")
    objStream.Type = 1
    objStream.Mode = 3
    objStream.Open
    objStream.Write strBody
    objStream.Position = 0
    objStream.Type = 2
    objStream.Charset = CodeBase
    BytesToBstr = objStream.ReadText
    objStream.Close
    Set objStream = Nothing
End Function

#6


学习~~~mark一下~~~~~

#1


GZIP可能也有很多种,多找几种试试吧

#2


mark

#3


http://msdn2.microsoft.com/zh-cn/library/system.io.compression.gzipstream(VS.80).aspx

#4


简单,你发送的GET请求中,不要使用Accept-Encoding

#5


    Set XMLHTTP = CreateObject("MSXML2.xmlhttp")
    With XMLHTTP
        .Open "GET", geturl, False
         'we need to setrequestheaders twice due to KB article Q234486.
'        .setRequestHeader "Cookie", "x=y"
        .setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"
        .setRequestHeader "Referer", strReferer
        .setRequestHeader "accept-language", strLang
        .setRequestHeader "content-type", ""
        .setRequestHeader "content-length", ""
        .setRequestHeader "accept-encoding", "gzip, deflate"
        .setRequestHeader "accept", "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*"
        .send
    End With
    
    XmlGetData = BytesToBstr(getbody, "gb2312")

Public Function BytesToBstr(strBody, CodeBase)
    Dim objStream
    Set objStream = CreateObject("Adodb.Stream")
    objStream.Type = 1
    objStream.Mode = 3
    objStream.Open
    objStream.Write strBody
    objStream.Position = 0
    objStream.Type = 2
    objStream.Charset = CodeBase
    BytesToBstr = objStream.ReadText
    objStream.Close
    Set objStream = Nothing
End Function

#6


学习~~~mark一下~~~~~