Results 1 to 4 of 4

Thread: Indy 10 - problem with IdHTTP.Get method

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Indy 10 - problem with IdHTTP.Get method

    :arrow: System: Windows XP, Pentium D 3,0 GHz, GeForce 7600 GS
    :arrow: Compiler/IDE: Delphi 2007 for Win32
    :arrow: API/Packages: Indy 10

    Welcome!

    I've got a problem with IdHTTP.Get method. I use this code to retrieve website's HTML code:
    [pascal]
    var
    S: TMemoryStream;
    X: String;
    begin
    S := TMemoryStream.Create();
    X := 'http://www.wikipedia.pl';
    try
    IdHTTP.Get(X, S);
    S.Position := 0;
    Memo.Lines.LoadFromStream(S);
    finally
    S.Free();
    end;[/pascal]

    And it works perfectly for this website and a few others:
    Code:
    http://szukaj.torrenty.org/szukaj2.php?szukaj=crysis
    http://www.animenewsnetwork.com/search?cx=016604166282602569737%3Aznd1ysjewre&cof=FORID%3A11&q=da+capo
    But when I try to get the code of this one, it returns some weird ASCII characters:
    [pascal]
    X := 'http://anidb.net/perl-bin/animedb.pl?show=animelist&adb.search=Darker&do.sea rch=search';
    [/pascal]

    What am I doing wrong? :?
    If you need any additional information, please let me know.

    Best Regards.

    EDIT
    Problem solved!

  2. #2

    Indy 10 - problem with IdHTTP.Get method

    Just out of interest what was the problem?
    <A HREF="http://www.myhpf.co.uk/banner.asp?friend=139328">
    <br /><IMG SRC="http://www.myhpf.co.uk/banners/60x468.gif" BORDER="0">
    <br /></A>

  3. #3
    PGD Community Manager AthenaOfDelphi's Avatar
    Join Date
    Dec 2004
    Location
    South Wales, UK
    Posts
    1,245
    Blog Entries
    2

    What was wrong?

    For anyone who may have been pondering this one (a quick post to say what was wrong would help others)... the problem was content encoding.

    Webservers are supposed to look at the HTTP request headers in order to determine what kind of encoding is acceptable for the response. Normally when surfing with Firefox for example, this will be gzip/deflate (IIRC) and when requesting with the Indy components, its normally blank meaning only plain text is acceptable (IIRC).

    This particular webserver was ignoring this field and was gzipping the response regardless.

    As a consequence, the client needed to look at the encoding information for the response and take appropriate action... in this case, decompress the response using a gzip library such as Abbrevia.
    :: AthenaOfDelphi :: My Blog :: My Software ::

  4. #4

    Re: What was wrong?

    Quote Originally Posted by AthenaOfDelphi
    For anyone who may have been pondering this one (a quick post to say what was wrong would help others)... the problem was content encoding
    Yes indeed. I used TIdCompressorZLibEx to decode the data. My little brother (who is not a programmer) suggested me, that the data is encrypted a look for something to decrypt it. :lol:

    Anyway, thank you for your interest! Next time I'll write a few words about the solution.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •