delphi XE8 NetHTTPRequest NetHTTPClient
delphi xe8 推出2个新http控件,NetHTTPRequest、NetHTTPClient
可以调用ASP.Net 一般应用程序获取网页数据,用旧的控件idhttp控件也可以,推荐用新的这2个组件。
TNetHttpClient不依赖OPENSSL
http://localhost:52384/Handler1.ashx
procedure TForm5.Button1Click(Sender: TObject); var ss: TStringStream; begin ss := TStringStream.Create('', TEncoding.ASCII);//中文用UTF8 ss.Clear; self.NetHTTPClient1.Get(url, ss); self.Caption := ss.DataString; ss.Free; end;
procedure TForm5.Button2Click(Sender: TObject);
var
ss: TStringStream;
begin
ss := TStringStream.Create('', TEncoding.ASCII);
ss.Clear;
self.NetHTTPRequest1.Get(url);
self.Caption := ss.DataString;
ss.Free;
end;