Changeset 4
- Timestamp:
- Mar 13, 2013, 11:29:59 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 10 added
- 3 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 -
trunk/UFormMain.lfm
r3 r4 10 10 object LabeledEdit1: TLabeledEdit 11 11 Left = 8 12 Height = 2 112 Height = 27 13 13 Top = 25 14 14 Width = 488 … … 18 18 EditLabel.AnchorSideBottom.Control = LabeledEdit1 19 19 EditLabel.Left = 8 20 EditLabel.Height = 1 321 EditLabel.Top = 920 EditLabel.Height = 17 21 EditLabel.Top = 5 22 22 EditLabel.Width = 488 23 23 EditLabel.Caption = 'Token' 24 24 EditLabel.ParentColor = False 25 25 TabOrder = 0 26 end 27 object Button1: TButton 28 Left = 56 29 Height = 25 30 Top = 184 31 Width = 112 32 Action = ADownload 33 TabOrder = 1 26 34 end 27 35 object TrayIcon1: TTrayIcon … … 4331 4339 object ActionList1: TActionList 4332 4340 Images = ImageList1 4333 left = 26 24341 left = 264 4334 4342 top = 93 4335 4343 object AShow: TAction … … 4341 4349 OnExecute = AExitExecute 4342 4350 end 4351 object ADownload: TAction 4352 Caption = 'Zkontrolovat' 4353 OnExecute = ADownloadExecute 4354 end 4343 4355 end 4344 4356 object ImageList1: TImageList -
trunk/UFormMain.pas
r3 r4 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 ExtCtrls, Menus, ActnList ;9 ExtCtrls, Menus, ActnList, httpsend, UFioAPI; 10 10 11 11 type … … 14 14 15 15 TFormMain = class(TForm) 16 ADownload: TAction; 16 17 AExit: TAction; 17 18 AShow: TAction; 18 19 ActionList1: TActionList; 20 Button1: TButton; 19 21 ImageList1: TImageList; 20 22 LabeledEdit1: TLabeledEdit; … … 23 25 PopupMenuTray: TPopupMenu; 24 26 TrayIcon1: TTrayIcon; 27 procedure ADownloadExecute(Sender: TObject); 25 28 procedure AExitExecute(Sender: TObject); 26 29 procedure AShowExecute(Sender: TObject); … … 50 53 end; 51 54 55 procedure TFormMain.ADownloadExecute(Sender: TObject); 56 var 57 FioAPI: TFioAPI; 58 begin 59 FioAPI := TFioAPI.Create; 60 try 61 FioAPI.Download; 62 finally 63 FioAPI.Free; 64 end; 65 end; 66 52 67 end. 53 68
Note:
See TracChangeset
for help on using the changeset viewer.