Merhaba Frmtr uyeleri , konu anlatımına hemen gecelim;
oncelikle formunuza 1 adet idHTTP , 10 adet label ekliyoruz.
Daha sonra Label1'e:Euro Label2'ye: Dolar Label3'e:Euro Satış Label4'e:Euro Alış
Label6'ye: Dolar Satış Label8'e: Dolar Alış yazın.(Labelleri ben boyle dizdiğim icin label sıralaması kodda bu sıralamaya gore)
Daha sonra projenize şu kodu uygulayınız ;
Kod:
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP, StdCtrls; type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Label7: TLabel; Label8: TLabel; Label9: TLabel; Label10: TLabel; Label11: TLabel; IdHTTP1: TIdHTTP; procedure FormCreate(Sender: TObject); private public end; var Form1: TForm1; implementation procedure TForm1.FormCreate(Sender: TObject); var z,ze,s,se,alis,alise,satis,satise,aranan,aranan2:s tring; yer,yere,i:Integer; begin s:=IDHttp1.Get('http://www.tcmb.gov.tr/kurlar/today.html'); z:=IDHttp1.Get('http://www.tcmb.gov.tr/kurlar/today.html'); se:=IDHttp1.Get('http://www.tcmb.gov.tr/kurlar/today.html'); ze:=IDHttp1.Get('http://www.tcmb.gov.tr/kurlar/today.html'); aranan:='1 ABD DOLARI'; aranan2:='1 EURO'; for i:=1 to 1 do begin yer:=pos(aranan,s); yer:=pos(aranan,z); yere:=pos(aranan2,se); yere:=pos(aranan2,ze); if yer=0 then begin ShowMessage('Kur bilgisi yok'); exit; end else begin yer:=yer+length(aranan); yere:=yere+length(aranan2); s:=copy(s,yer,length(s)-yer); z:=copy(z,yer,length(s)-yer); se:=copy(se,yere,length(se)-yere); ze:=copy(ze,yere,length(se)-yere); s:=trim(s); z:=trim(z); se:=trim(se); ze:=trim(ze); alis:=copy(s,1,9); satis:=copy(z,14,9); alise:=copy(se,1,10); satise:=copy(ze,14,10); label5.caption:= alis + 'YTL' ; label7.caption:= satis + 'YTL' ; label10.caption:= alise + 'YTL' ; label9.caption:= satise + 'YTL' ; end; end; end; end.
İyi gunler..
tugsat
delphi



__________________