[fpc-pascal] A simple HTTP request with FPC standard units
Luciano de Souza
luchyanus at gmail.com
Fri Nov 23 17:48:02 CET 2012
Yes, when I ask for a simple way, I could not imagine something so simpler!
Thank you. Your tip help me a lot.
The success of your answer is so that I add a question: is there also a
FPC native unit dealing with SMTP?
Em 23-11-2012 14:15, Michael Van Canneyt escreveu:
>
>
> 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.
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
More information about the fpc-pascal
mailing list