Ah bueno tu solución también es válida, mira lo que conseguí en internet para ayudarme también, un
TIdHTTP de
Indy:
Código Delphi
[-]internetFile := 'http://api.twitter.com/1/statuses/user_timeline.xml?include_entities=false&include_rts=true&screen_name=twitterapi&count=15';
localFileName := 'user_timeline.xml';
try
Http := TIdHTTP.Create(nil);
try
MS := TMemoryStream.Create;
try
Http.OnWork:= HttpWork;
Http.Get(internetFile, MS);
MS.SaveToFile(localFileName);
finally
MS.Free;
end;
finally
Http.Free;
end;
Y Http.Work es:
Código Delphi
[-]
private
procedure HttpWork(ASender: TObject; AWorkMode: TWorkMode; AWorkCount: Int64);
...
procedure TFormMain.HttpWork(ASender: TObject; AWorkMode: TWorkMode; AWorkCount: Int64);
var
Http: TIdHTTP;
ContentLength: Int64;
Percent: Integer;
begin
Http := TIdHTTP(ASender);
ContentLength := Http.Response.ContentLength;
if (Pos('chunked', LowerCase(Http.Response.TransferEncoding)) = 0) and
(ContentLength > 0) then
begin
Percent := 100*AWorkCount div ContentLength;
end;
end;
Vean que también usé
URLDownloadToFile de
URLMon, pero no lo probé mucho realmente. Tal vez sirve mejor que este parapeto que tengo allí jajaja Gracias a todos por ayudarme :-)