• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 507
  • Last Modified:

Downloading Images via THTTPCli (FPiette)

Ive got a question; Im trying to make a program that
can search and show images from internet.

This works for the biggest part, but for some reason some images
from specific server return either a 404 page or an 'unauthorised' image.

Ive tried the following code to create the instance (in a thread)

  Fhttp := THttpCli.Create(nil);
  Fhttp.MultiThreaded := True;
  FHttp.Reference := HTTPReferer;
  FHttp.Sender := HTTPReferer;
  FHttp.Agent := 'Mozilla/2.0 (compatible; MSIE 3.02; Update a; AOL 3.0; Windows 95) ';
  if fileexists(HTTPfileName) then deleteFile(HTTPfileName);
  Self.Fhttp.RcvdStream := TFileStream.Create(HTTPfileName, fmCreate);

Where the referer is the 'normal' calling page of the image. Im not sure what Sender is
with THttpCli.

Im I missing some headers or something ?
Any help would be great!

1 Solution

Are you using the absolute latest version of FPiette's Suite?

Do you belong to TWSocket elist: A forum for Q's of this type.

Here are some of the rules:
To all subscribers:

1) Please do not use HTML or RTF messages in the list. Use only plain/text
    messages (by default Outlook uses HTML ! You must change the setting).
    When replying, be sure to use plain/text. If someone email to list
    accidently NOT in plain text and if you reply to it, do take care you
    reply in plain text
2) Please do not include VCF to your messages.
3) Stay on topic ! Do not post off-topic messages and do not answer
    off-topic messages.
4) Always use a subject and change message subject when required. Do not
    change subject when not needed because message thread is lost.
    Always mention which component you talk about and OS version.
5) Do not attach files to your messages. If you have something to give, just
    tell us in the list. Interested people will contact you to get the file.
6) Post messages using the EMail address you used to subscribe.
    No alias allowed. If you use an alias, your message will not appears in
    the list.
7) If you change message subject please dont hit 'reply', but compose a
    new message. Some mail readers group messages per ID instead
    of subject.
8) Do not forget to send your registration postcard :-)

Have you asked this Q on this topic to elist?

As for your particular Q here there are some websites that recognize what browser,(IE or Netscape) if any you are using. Some refuse if not a recognized browser.

Is this your programming creation?
Have you tested this particular site with one of the test models in the ICS package. Do you have all the various parts included?(I see some of the items in your Q belong in the HTTPprot unit)

Hi D3!

Ive figured it out in the meantime, basicly I had my referrer wrong.
This was because I build it from a one threaded application to a multithreaded one, which messed up the sequence of the referrer.

The app works fine now, and all images are loaded properly.

Ive made this little proggie yeah, but just starting it up. Basicly it'll become a gallery html stripper, which will download all galleries and images it finds.
The main plan is creating an indexing program for massive gallery stuff, mainly for work, because a client wants to categorize its images.

This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.
PAQed - no points refunded (of 75)

Community Support Moderator

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now