Changeset 4 for trunk/UFioAPI.pas
- Timestamp:
- Mar 13, 2013, 11:29:59 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UFioAPI.pas
r3 r4 6 6 7 7 uses 8 Classes, SysUtils ;8 Classes, SysUtils, httpsend; 9 9 10 10 type 11 12 { TFioAPI } 13 11 14 TFioAPI = class 12 15 Token: string; 16 Format: string; 17 function Download: Boolean; 13 18 end; 14 19 15 20 implementation 16 21 22 { TFioAPI } 23 24 function TFioAPI.Download: Boolean; 25 var 26 HTTPSender: THTTPSend; 27 begin 28 HTTPSender := THTTPSend.Create; 29 try 30 Format := 'xml'; 31 Token := 'dd'; 32 // HTTPSender.HTTPMethod('GET', 'https://www.fio.cz/ib_api/rest/periods/' + Token + 33 // '/2013-03-01/2013-03-15/transactions.' + Format); 34 HTTPSender.HTTPMethod('GET', 'https://www.fio.cz/e-broker/e-broker.cgi'); 35 try 36 case HTTPSender.Resultcode of 37 100..299: 38 begin 39 { with TFileStream.Create(TargetFile, fmCreate or fmOpenWrite) do 40 try 41 Seek(0, soFromBeginning); 42 CopyFrom(HTTPSender.Document, 0); 43 finally 44 Free; 45 end;} 46 Result := True; 47 end; //informational, success 48 300..399: Result := False; //redirection. Not implemented, but could be. 49 400..499: Result := False; //client error; 404 not found etc 50 500..599: Result := False; //internal server error 51 else Result := False; //unknown code 52 end; 53 except 54 // We don't care for the reason for this error; the download failed. 55 Result := false; 56 end; 57 finally 58 HTTPSender.Free; 59 end; 60 end; 61 17 62 end. 18 63
Note:
See TracChangeset
for help on using the changeset viewer.