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 - [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal