[fpc-pascal] A simple HTTP request with FPC standard units
silvioprog
silvioprog at gmail.com
Sat Nov 24 00:36:39 CET 2012
2012/11/23 Michael Van Canneyt <michael at freepascal.org>
> On Fri, 23 Nov 2012, luciano de souza wrote:
>
> Hello listers,
>> Using Synapse, the developer has very good features to deal with the
>> HTTP protocol. But imagine you want only to do a "get" in a URL and
>> take a string back. I imagine it can be done with the standard units
>> of Freepascal. Is it true? How could I do it with FPC 2.7.1?
>>
>
> very simple:
>
> uses fphttpclient;
>
> Var
> S : String;
>
> begin
> With TFPHttpClient.Create(Nil) do
> try
> S:=Get(ParamStr(1));
> finally
> Free;
> end;
> Writeln('Got : ',S);
> end.
>
>
> home: >fpc -S2 th.pp
> /usr/bin/ld: warning: link.res contains output sections; did you forget -T?
> home: >th http://www.freepascal.org/
> Got : <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <!-- Web Page Design by James Koster - http://www.jameskoster.co.uk and
> Marko Mihel?i? - http://www.mcville.net-->
>
> <head>
>
> I cut off the rest.
>
> Michael.
>
Really TFPHttpClient is a pleasant class. Now I updated EasyRSS plugin for
use it.
Thank you again Michael! :)
--
Silvio Clécio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20121123/41eceba5/attachment.html>
More information about the fpc-pascal
mailing list