unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,IdHTTP, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function GetWebPage(const Url :string; IsUtf8 :Boolean = False):string;
var
idp :TIdHTTP;
begin
Result := '';
idp := TIdHTTP.Create(Application);
try
idp.HandleRedirects := True;
idp.Request.UserAgent := 'Mozilla/5.0';
Result := idp.Get(Url);
if IsUtf8 then
Result := Utf8ToAnsi(Result);
finally
FreeAndNil(idp);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage(GetWebPage('http://lede100.wicp.net:9600/lede/index.php/Dati/Index/Index.html',true));
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,IdHTTP, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function GetWebPage(const Url :string; IsUtf8 :Boolean = False):string;
var
idp :TIdHTTP;
begin
Result := '';
idp := TIdHTTP.Create(Application);
try
idp.HandleRedirects := True;
idp.Request.UserAgent := 'Mozilla/5.0';
Result := idp.Get(Url);
if IsUtf8 then
Result := Utf8ToAnsi(Result);
finally
FreeAndNil(idp);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage(GetWebPage('http://lede100.wicp.net:9600/lede/index.php/Dati/Index/Index.html',true));
end;
end.