-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathuDMHTTP.pas
More file actions
executable file
·49 lines (39 loc) · 953 Bytes
/
uDMHTTP.pas
File metadata and controls
executable file
·49 lines (39 loc) · 953 Bytes
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
unit uDMHTTP;
interface
uses
System.SysUtils, System.Classes, System.Net.URLClient, System.Net.HttpClient,
System.Net.HttpClientComponent;
type
TDMHTTP = class(TDataModule)
NetHTTPRequest1: TNetHTTPRequest;
NetHTTPClient1: TNetHTTPClient;
private
{ Private declarations }
public
procedure GetResponse(aURL: string; memstr: TMemoryStream);
function GetRespString(aURL: string): string;
end;
var
DMHTTP: TDMHTTP;
implementation
{$R *.dfm}
{ TDMHTTP }
procedure TDMHTTP.GetResponse(aURL: string; memstr: TMemoryStream);
begin
if (aURL <> '') and (memstr <> nil) then
begin
NetHTTPRequest1.Get(aURL, memstr);
end;
end;
function TDMHTTP.GetRespString(aURL: string): string;
var strstr: TStringStream;
begin
strstr := TStringStream.Create;
try
GetResponse(aURL, strstr);
Result := strstr.DataString;
finally
strstr.Free;
end;
end;
end.