Delphi Can
Multi Device uygulaması ile WEB SİTE'sinin html içerik bilgisini almak - Baskı Önizleme

+- Delphi Can (https://www.delphican.com)
+-- Forum: Delphi (https://www.delphican.com/forumdisplay.php?fid=3)
+--- Forum: Genel Programlama (https://www.delphican.com/forumdisplay.php?fid=6)
+--- Konu Başlığı: Multi Device uygulaması ile WEB SİTE'sinin html içerik bilgisini almak (/showthread.php?tid=5948)



Multi Device uygulaması ile WEB SİTE'sinin html içerik bilgisini almak - guverdik - 24-04-2021

Multi device veya VCL uygulaması ile herhangi bir web sitesinin içerik bilgisini WebBrowser bileşeni ile gösterebiliyorduk. Fakat gelen web html içeriklerini Memo gibi bir delphi bieleşenine aktarmakta "almakta" oldukça zorlanıyorduk, özellikle Android mobile uygulamalarda. @AhmetNuri beyin destekleriyle çözdüğümüz bu olayı paylaşmak istedim. Umarım faydalı olur.

[attachment=1732]

KAYNAK KODLARI:
unit Unit3;

interface

uses
 System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
 FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Memo.Types,
 FMX.StdCtrls, FMX.ScrollBox, FMX.Memo, FMX.Controls.Presentation, FMX.Edit,
 IdIntercept, IdGlobal, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP,
 IdBaseComponent;

type
 TForm3 = class(TForm)
   Edit1: TEdit;
   Memo1: TMemo;
   Button1: TButton;
   IdConnectionIntercept1: TIdConnectionIntercept;
   IdHTTP1: TIdHTTP;
   procedure IdConnectionIntercept1Receive(ASender: TIdConnectionIntercept;
     var ABuffer: TIdBytes);
   procedure Button1Click(Sender: TObject);
 private
   { Private declarations }
 public
   { Public declarations }

 end;

var
 Form3: TForm3;

implementation

{$R *.fmx}

procedure TForm3.Button1Click(Sender: TObject);
begin
 try
   IdHTTP1.Get(Edit1.Text);
 Except
 end;
end;

procedure TForm3.IdConnectionIntercept1Receive(ASender: TIdConnectionIntercept; var ABuffer: TIdBytes);
var LengArray: integer; AStr: AnsiString; Str: string;
begin
 Memo1.Lines.Clear;
 LengArray := Length(ABuffer);
 SetString(AStr, PAnsiChar(@ABuffer[0]), LengArray);
 Str :=  Copy ( AStr,0,LengArray);
 Memo1.Lines.Add(Str);
end;

end.