fphttpclient

From Free Pascal wiki
Revision as of 11:56, 24 November 2012 by BigChimp (talk | contribs)
Jump to navigationJump to search

fphttpclient is supplied with FPC as part of the fcl-web package, and can be used by itself as well.

Examples

Get body of an HTTP page

uses fphttpclient;

Var
  S : String;

begin
  With TFPHttpClient.Create(Nil) do
    try
      S:=Get(ParamStr(1));
  finally
    Free;
  end;
  Writeln('Got : ',S);
end.

If you want to write even less lines of code, in FPC 2.7.1 you can use the class method:

s := TFPCustomHTTPClient.SimpleGet('http://a_site/a_page');