indy idHttp + file download
Hi i've a list of Files to be downloaded :
1: http_://www.myweb.com/myfile.zip 2: http_://www.mywebcom.com/get.php?id=02906 3: http_://www.mywebcom.com/file.php?e=02906 the 1st link is easy to download / handle , But the problem is with Links #2 and #3 . my idhttp handleRedirects property is True and RedirectMaximum is 15 But still no Chance to handle Them ( #2 and #3 Links ) . so please how could i handle them ? |
AW: indy idHttp + file download
Hello,
is it possible to access link #2 and #3 with a common webbrowser? Do you have the chance to trace the access attempts (i.e. with wireshark)? Best regards Klaus |
AW: indy idHttp + file download
Thank you Klaus01 .
Zitat:
and other question : Is it possible to ignore the Downloading process in case of URL Redirect and continue with others ; that means : Ignore URL Redirection for link #2 and #3 and continue downloading the other links ? |
AW: indy idHttp + file download
Sure. Just handle the error.
|
AW: indy idHttp + file download
Zitat:
cause if i put handleRedirects property to False and idhttp faces an URL redirectios it will raise an exception with the Famous error http//1.1 302 found . |
AW: indy idHttp + file download
Code:
try
excpet on NotFound jumpt to next download in queue end; |
AW: indy idHttp + file download
thank you Luckie
Here is my Thread Code : Could you Fix it for me please . many thanks
Delphi-Quellcode:
procedure TFileDownThread.Execute;
var FStream: TFileStream; i:Integer; begin For i:=0 to FUrl.Count-1 do begin IdHTTP := TIdHTTP.Create(nil); try IdHTTP.Request.UserAgent := 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)'; IdHTTP.OnWorkBegin := FWorkBeginEvent; IdHTTP.OnWork := FWorkEvent; IdHTTP.OnWorkEnd := FWorkEndevent; IdHTTP.HandleRedirects:=False; // IdHTTP.RedirectMaximum := 15; // Idhttp.OnRedirect:=OnRedirect; IdHTTP.Head(URL[i]); BytesInsgesamt := IdHTTP.Response.ContentLength; FStream:= TFileStream.Create(ExtractUrlFileName(URL[i]), fmCreate); IdHTTP.Get(URL[i], FStream); finally IdHTTP.Free; FStream.Free; end; // Synchronize(ShowCode); end; end; |
AW: indy idHttp + file download
Delphi-Quellcode:
Just to show you the main principle.
procedure TForm1.Button1Click(Sender: TObject);
var i: Integer; begin FileList := TStringList.Create; try FileList.Add('http://www.michael-puff.de/Programmierung/Delphi/Programme/AdressDB.zip'); FileList.Add('http://www.michael-puff.de/Programmierung/Delphi/Programme/AdressDB_nonVCL.zip'); FileList.Add('kdvndk'); FileList.Add('http://www.michael-puff.de/Programmierung/Delphi/Programme/AudioPlayer.zip'); for i := 0 to FileList.Count - 1 do begin try Download(i); except on E: EIdReadTimeOut do begin Memo1.Lines.Add(E.Message); Continue; end; end; end; finally FileList.Free end; end; procedure TForm1.Download(index: Integer); begin IdHTTP1.Head(FileList[index]); Memo1.Lines.Add(IntToStr(IdHTTP1.Response.ContentLength)); end; |
AW: indy idHttp + file download
Thank you Luckie i will apply your Idea .
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:13 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz