Advertisement
Guest User

Untitled

a guest
Mar 4th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. oWhr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
  2. oWhr.Open("GET", "https://www.phpbb.com/ideas/", false)
  3. oWhr.SetRequestHeader("Accept-Encoding", "gzip, deflate, br")
  4. oWhr.Send()
  5.  
  6. MsgBox, % oWhr.getAllResponseHeaders()
  7. MsgBox, % oWhr.status
  8.  
  9. arr := oWhr.ResponseBody
  10. length := arr.MaxIndex() + 1
  11. pData := NumGet( ComObjValue(arr) + 8 + A_PtrSize )
  12. MsgBox, % res := GzipDecode(pData, length)
  13.  
  14. GzipDecode(pData, size) {
  15.    arr := "["
  16.    Loop % size
  17.       arr .= (arr = "[" ? "" : ",") . NumGet(pData + A_Index - 1, "UChar")
  18.    arr .= "]"
  19.  
  20.    html =
  21.    (
  22.    <!DOCTYPE html>
  23.    <html>
  24.    <head>
  25.      <meta http-equiv="X-UA-Compatible" content="IE=edge">
  26.      <script src="https://cdnjs.cloudflare.com/ajax/libs/pako/1.0.8/pako.min.js"></script>
  27.      <script>
  28.        var charData = %arr%;
  29.        var binData  = new Uint8Array(charData);
  30.        var data     = pako.inflate(binData);
  31.        var strData  = String.fromCharCode.apply(null, new Uint16Array(data));
  32.      </script>
  33.    </head>
  34.    </html>
  35.    )
  36.    oDoc := ComObjCreate("htmlfile")
  37.    oDoc.write(html)
  38.    Loop {
  39.       Sleep, 10
  40.       try res := oDoc.parentWindow.strData
  41.       catch
  42.         continue
  43.       break
  44.    }
  45.    Return res
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement