LAN Web TCP Delphi

unit kur;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdHTTP, Grids, ComCtrls,dateutils;
type
TForm1 = class(TForm)
IdHTTP1: TIdHTTP; // indy client in içinde
Button1: TButton;
sg1: TStringGrid; //eklemeyi unutmayın
tr: TDateTimePicker; //eklemei unutmayın
procedure Button1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
const
dkur : array [1..12] of string = ('1 ABD DOLARI','1 AVUSTRALYA DOLARI','1 DANİMARKA KRONU',
'1 İNGİLİZ STERLİNİ','1 İSVİÇRE FRANGI','1 İSVEÇ KRONU',
'1 JAPON YENİ','1 KANADA DOLARI','1 KUVEYT DİNARI',
'1 NORVEÇ KRONU','1 SUUDİ ARABİSTAN RİYALİ','1 EURO');
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
z,s:ansistring;
alis,satis:string;
konum,i:Integer;
begin
for i:=1 to sg1.RowCount do sg1.Rows[i].Clear;
try
if datetostr(tr.Date) <> datetostr(now) then
begin
s:=IDHttp1.Get('http://www.tcmb.gov.tr/kurlar/'+formatdatetime('yyyymm',tr.date)+'/'+formatdatetime('ddmmyyyy',tr.date)+'.html');
z:=IDHttp1.Get('http://www.tcmb.gov.tr/kurlar/'+formatdatetime('yyyymm',tr.date)+'/'+formatdatetime('ddmmyyyy',tr.date)+'.html');
end else
begin
s:=IDHttp1.Get('http://www.tcmb.gov.tr/kurlar/today.html');
z:=IDHttp1.Get('http://www.tcmb.gov.tr/kurlar/today.html');
end;
except
showmessage('Tatil günü seçtiniz veya internet bağlantınız yok');
exit;
end;
for i:=1 to 12do
begin
konum:=pos(dkur[i],s);
konum:=pos(dkur[i],z);
if konum<>0 then
begin
konum:=konum+length(dkur[i]);
s:=copy(s,konum,length(s)-konum);
z:=copy(z,konum,length(s)-konum);
s:=trim(s);
z:=trim(z);
alis:=copy(s,1,9);
satis:=copy(z,14,9);
sg1.Cells[0,i]:=dkur[i];
sg1.Cells[1,i]:=alis;
sg1.Cells[2,i]:=satis;
end;
end;
end;
procedure TForm1.FormShow(Sender: TObject);
var
i:integer;
begin
for i:=1 to sg1.RowCount do sg1.Rows[i].Clear;
sg1.Cells[0,0]:='Döviz Türü';
sg1.Cells[1,0]:='Alış';
sg1.Cells[2,0]:='Satış';
end;
end.