-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathmain.pas
More file actions
65 lines (54 loc) · 1.21 KB
/
main.pas
File metadata and controls
65 lines (54 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
unit main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, clTcpClient, clHttp, clHtmlParser, clTcpClientTls, DemoBaseFormUnit;
type
TForm1 = class(TclDemoBaseForm)
Panel1: TPanel;
memResult: TMemo;
Label1: TLabel;
edtUrl: TEdit;
Label2: TLabel;
Button1: TButton;
clHttp1: TclHttp;
clHtmlParser1: TclHtmlParser;
cbShowText: TCheckBox;
procedure Button1Click(Sender: TObject);
procedure clHtmlParser1ParseTag(Sender: TObject; ATag: TclHtmlTag);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
html: TStrings;
begin
memResult.Lines.Clear();
html := TStringList.Create();
try
clHttp1.Get(edtUrl.Text, html);
if cbShowText.Checked then
begin
clHtmlParser1.Parse(html);
end else
begin
memResult.Lines.Assign(html);
end;
finally
html.Free();
end;
end;
procedure TForm1.clHtmlParser1ParseTag(Sender: TObject; ATag: TclHtmlTag);
begin
if (Trim(ATag.Text) <> '') then
begin
memResult.Lines.Add(ATag.Text);
end;
end;
end.