Jump to content

Inetget() downloaded file is corrupted/garbled (gzip encoding)


garbb
 Share

Recommended Posts

If I visit this (http://www.torrentday.com/torrents/rss?u=1) url in a browser it will appear as an XML rss feed. But if I download it with InetGet() like this:

InetGet('http://www.torrentday.com/torrents/rss?u=1',@TempDir & "\file.txt")

And then open up the file with a text editor it does not look like an xml file:

post-75655-0-22452000-1386715486_thumb.p

I have tried this with other rss feeds and the files are all ok (the downloaded file is a normal xml document and is viewable in a text editor)

Anyone have any idea what is going on? Maybe the server is using some different encoding for this file and the browser is "translating" it but autoit's InetGet() function is not?

Ok, so i basically solved my own problem but I figured I would leave this here in case someone else has the same issue. The response from the server was gzip encoded which InetGet() can't deflate so I am using the following function instead:

Func get_url($url)
    $RequestURL = $url;
    Global $oHTTP = ObjCreate("Msxml2.XMLHTTP.4.0") ;
    $oHTTP.Open("GET", $RequestURL, False)
    $oHTTP.Send()
    if  $oHTTP.status == 200 Then
        Return $oHTTP.ResponseText
    Else
        Return SetError(1,0,$oHTTP.status)
    EndIf
EndFunc

Because Msxml2.XMLHTTP.4.0 can handle gzip encoding.

Edited by garbb
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...