I solved the error. In:<div><br></div><div>fphttpclient.pas:line285<br></div><div><div>Function TFPCustomHTTPClient.GetServerURL(URI : TURI) : String;</div><div><br></div><div>Var</div><div> D : String;</div><div><br></div>
<div>begin</div><div> D:=URI.Path;</div><div> If (D[1]<>'/') then</div><div> D:='/'+D;</div><div> If (D[Length(D)]<>'/') then</div><div> D:=D+'/';</div><div> Result:=D+URI.Document;</div>
<div> if (URI.Params<>'') then</div><div> Result:=Result+'?'+URI.Params;</div><div>end;</div><div class="gmail_extra"><br></div><div class="gmail_extra">I changed to:</div><div class="gmail_extra">
<br></div><div class="gmail_extra"><div class="gmail_extra">Function TFPCustomHTTPClient.GetServerURL(URI : TURI) : String;</div><div class="gmail_extra"><br></div><div class="gmail_extra">Var</div><div class="gmail_extra">
D : String;</div><div class="gmail_extra"><br></div><div class="gmail_extra">begin</div><div class="gmail_extra"> D:=URI.Path;</div><div class="gmail_extra"> If Length(D) = 0 then</div><div class="gmail_extra"> D := '/';</div>
<div class="gmail_extra"> If (D[Length(D)]<>'/') then</div><div class="gmail_extra"> D:=D+'/';</div><div class="gmail_extra"> Result:=D+URI.Document;</div><div class="gmail_extra"> if (URI.Params<>'') then</div>
<div class="gmail_extra"> Result:=Result+'?'+URI.Params;</div><div class="gmail_extra">end; </div><div class="gmail_extra"><br></div><div class="gmail_extra">And worked fine:</div><div class="gmail_extra"><br>
</div>
<div class="gmail_extra">==============</div><div class="gmail_extra"><div class="gmail_extra">C:\Users\silvioprog\Desktop\test>project1.exe</div><div class="gmail_extra">Got : <!DOCTYPE html></div><div class="gmail_extra">
<!--[if lt IE 7 ]> <html lang="pt-br" class="no-js ie6"> <![endif]--></div><div class="gmail_extra"><!--[if IE 7 ]> <html lang="pt-br" class="no-js ie7"> <![endif]--></div>
<div class="gmail_extra"><!--[if IE 8 ]> <html lang="pt-br" class="no-js ie8"> <![endif]--></div><div class="gmail_extra"><!--[if IE 9 ]> <html lang="pt-br" class="no-js ie9"> <![endif]--></div>
<div class="gmail_extra"><!--[if (gt IE 9)|!(IE)]><!--><html lang="pt-br" class="no-js"><!--<![endif]--></div><div class="gmail_extra"><html></div><div class="gmail_extra">
<head></div><div class="gmail_extra"><!--[if ie]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><![end</div><div class="gmail_extra">if]--></div><div class="gmail_extra">
<title><a href="http://silvioprog.com.br">silvioprog.com.br</a> - Home</title></div><div class="gmail_extra"><meta charset="UTF-8"></div><div class="gmail_extra"><meta name="author" content="Silvio Clecio - <a href="mailto:silvioprog@gmail.com">silvioprog@gmail.com</a>"></div>
<div class="gmail_extra"><meta name="keywords" content="silvioprog, lazarus, freepascal, fpweb, cgi, laza</div><div class="gmail_extra">rus cgi, css, ajax, javascript, dom, desenvolvimento web, padroes web, internet</div>
<div class="gmail_extra">movel, mobilidade, microformats, xhtml, html5"></div><div class="gmail_extra"><meta name="viewport" content="width=device-width, initial-scale=1.0"></div><div class="gmail_extra">
<meta name="description" content="Bem-vindo ao espaƧo do desenvolvedor livre!"></div><div class="gmail_extra"><br></div><div class="gmail_extra"><meta name="generator" content="LazSolutions"></div>
<div class="gmail_extra"><link rel="author" href="humans.txt" type="text/plain"></div><div class="gmail_extra"><link rel="shortcut icon" href="favicon.ico"></div>
<div class="gmail_extra"><link rel="apple-touch-icon" href="apple-touch-icon.png"></div><div class="gmail_extra"><link rel="shortlink" href="<a href="http://tinyurl.com/silvioprog">http://tinyurl.com/silvioprog</a>"></div>
<div class="gmail_extra"><!--<link rel="stylesheet" href="css/style.css">--></div><div class="gmail_extra"><!--[if lt IE 8]><script src="js/ie6update.js"></script><![endif]--></div>
<div class="gmail_extra"><!--<script src="js/jquery.min.js"></script>--></div><div class="gmail_extra"><script type="text/javascript"></div><div class="gmail_extra"> var _gaq = _gaq || [];</div>
<div class="gmail_extra"> _gaq.push(['_setAccount', 'UA-17508381-4']);</div><div class="gmail_extra"> _gaq.push(['_setDomainName', '.<a href="http://com.br">com.br</a>']);</div><div class="gmail_extra">
_gaq.push(['_trackPageview']);</div><div class="gmail_extra"> (function() {</div><div class="gmail_extra"> var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.a</div><div class="gmail_extra">
sync = true;</div><div class="gmail_extra"> ga.src = ('https:' == document.location.protocol ? '<a href="https://ssl">https://ssl</a>' : '<a href="http://w">http://w</a></div><div class="gmail_extra">
ww') + '.<a href="http://google-analytics.com/ga.js">google-analytics.com/ga.js</a>';</div><div class="gmail_extra"> var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefor</div>
<div class="gmail_extra">e(ga, s);</div><div class="gmail_extra"> })();</div><div class="gmail_extra"></script></div><div class="gmail_extra"><style></div><div class="gmail_extra"> body { text-align: center;}</div>
<div class="gmail_extra"> h1 { font-size: 50px; text-align: center }</div><div class="gmail_extra"> span[frown] { transform: rotate(90deg); display:inline-block; color: #bbb; }</div><div class="gmail_extra"> body { font: 20px Constantia, 'Hoefler Text', "Adobe Caslon Pro", Baskerville</div>
<div class="gmail_extra">, Georgia, Times, serif; color: #999; text-shadow: 2px 2px 2px rgba(200, 200, 20</div><div class="gmail_extra">0, 0.5); }</div><div class="gmail_extra"> ::-moz-selection{ background:#FF5E99; color:#fff; }</div>
<div class="gmail_extra"> ::selection { background:#FF5E99; color:#fff; }</div><div class="gmail_extra"> article {display:block; text-align: left; width: 500px; margin: 0 auto; }</div><div class="gmail_extra"><br></div>
<div class="gmail_extra"> a { color: rgb(36, 109, 56); text-decoration:none; }</div><div class="gmail_extra"> a:hover { color: rgb(96, 73, 141) ; text-shadow: 2px 2px 2px rgba(36, 109, 56,</div><div class="gmail_extra">
0.5); }</div><div class="gmail_extra"></style></div><div class="gmail_extra"></head></div><div class="gmail_extra"><body></div><div class="gmail_extra"> <article></div><div class="gmail_extra"> <h1><a href="http://silvioprog.com.br">silvioprog.com.br</a></h1></div>
<div class="gmail_extra"> <div></div><div class="gmail_extra"> <p>OlĆ”, caro visitante,</p></div><div class="gmail_extra"> <p>Estamos importando todo o material do programmer ObjectPascal para e</div>
<div class="gmail_extra">ste novo espaƧo, aguarde.</p></div><div class="gmail_extra"> <ul></div><div class="gmail_extra"> </ul></div><div class="gmail_extra"> </div></div><div class="gmail_extra">
<br></div><div class="gmail_extra"> </article></div><div class="gmail_extra"></body></div><div class="gmail_extra"></html></div><div class="gmail_extra">==============<br></div></div><div class="gmail_extra">
<br></div><div class="gmail_extra">I'll open an issue in bugtracker, please wait me...</div><br><div class="gmail_quote">2012/11/23 silvioprog <span dir="ltr"><<a href="mailto:silvioprog@gmail.com" target="_blank">silvioprog@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">GREAT unit, I love Free Pascal!<div><br></div><div>Two errors, with:</div>
<div><br></div><div>================</div><div><div>program project1;</div><div><br></div><div>{$mode objfpc}{$H+}</div><div><br></div><div>uses</div>
<div> fphttpclient;</div><div><br></div><div>var</div><div> S: string;</div><div>begin</div><div> with TFPHttpClient.Create(nil) do</div><div> try</div><div> S := Get(ParamStr(1));</div><div> finally</div><div>
Free;</div><div> end;</div><div> WriteLn('Got : ', S);</div><div>end.</div><div class="gmail_extra">================</div><div class="gmail_extra"><br></div><div class="gmail_extra">I got:</div><div class="gmail_extra">
<br></div><div class="gmail_extra">================</div><div class="gmail_extra"><div class="gmail_extra">C:\Users\silvioprog\Desktop\test>project1.exe<br></div><div class="gmail_extra">An unhandled exception occurred at $004115F1:</div>
<div class="gmail_extra">EHTTPClient: Invalid protocol : ""</div><div class="gmail_extra"> $004115F1</div><div class="gmail_extra"> $0041189E</div><div class="gmail_extra"> $004118FE</div><div class="gmail_extra">
$0040167F main, line 13 of project1.lpr</div></div><div class="gmail_extra">================</div><div class="gmail_extra"><br></div><div class="gmail_extra">With:</div><div class="gmail_extra"><br></div><div class="gmail_extra">
================</div><div class="gmail_extra"><div class="gmail_extra">program project1;</div><div class="gmail_extra"><br></div><div class="gmail_extra">{$mode objfpc}{$H+}</div><div class="gmail_extra"><br></div><div class="gmail_extra">
uses</div><div class="gmail_extra"> fphttpclient;</div><div class="gmail_extra"><br></div><div class="gmail_extra">var</div><div class="gmail_extra"> S: string;</div><div class="gmail_extra">begin</div><div class="gmail_extra">
with TFPHttpClient.Create(nil) do</div><div class="gmail_extra"> try</div><div class="gmail_extra"> S := Get('<a href="http://silvioprog.com.br" target="_blank">http://silvioprog.com.br</a>');</div><div class="gmail_extra">
finally</div><div class="gmail_extra"> Free;</div><div class="gmail_extra"> end;</div><div class="gmail_extra"> WriteLn('Got : ', S);</div><div class="gmail_extra">end.</div></div><div class="gmail_extra">
================</div><div class="gmail_extra"><br></div><div class="gmail_extra">I got:</div><div class="gmail_extra"><br></div><div class="gmail_extra">================</div><div class="gmail_extra"><div class="gmail_extra">
C:\Users\silvioprog\Desktop\test>project1.exe<br></div><div class="gmail_extra">An unhandled exception occurred at $0040FE72:</div><div class="gmail_extra">EAccessViolation: Access violation</div><div class="gmail_extra">
$0040FE72</div><div class="gmail_extra"> $00410042</div><div class="gmail_extra"> $00411576</div><div class="gmail_extra"> $004117CE</div><div class="gmail_extra"> $0041182E</div><div class="gmail_extra"> $0040166D main, line 13 of project1.lpr</div>
</div><div class="gmail_extra">================</div><div class="gmail_extra"><br></div><div class="gmail_extra">What I'm is wrong?</div><div class="gmail_extra"><br></div><div class="gmail_extra">My environment:</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">Lazarus 1.1 r38836 FPC 2.7.1 i386-win32-win32/win64<div><div class="h5"><br><br><div class="gmail_quote">2012/11/23 Michael Van Canneyt <span dir="ltr"><<a href="mailto:michael@freepascal.org" target="_blank">michael@freepascal.org</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><br>
<br>
On Fri, 23 Nov 2012, luciano de souza wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Hello listers,<br>
Using Synapse, the developer has very good features to deal with the<br>
HTTP protocol. But imagine you want only to do a "get" in a URL and<br>
take a string back. I imagine it can be done with the standard units<br>
of Freepascal. Is it true? How could I do it with FPC 2.7.1?<br>
</blockquote>
<br></div>
very simple:<br>
<br>
uses fphttpclient;<br>
<br>
Var<br>
S : String;<br>
<br>
begin<br>
With TFPHttpClient.Create(Nil) do<br>
try<br>
S:=Get(ParamStr(1));<br>
finally<br>
Free;<br>
end;<br>
Writeln('Got : ',S);<br>
end.<br>
<br>
home: >fpc -S2 th.pp<br>
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?<br>
home: >th <a href="http://www.freepascal.org/" target="_blank">http://www.freepascal.org/</a><br>
Got : <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><br>
<html><br>
<!-- Web Page Design by James Koster - <a href="http://www.jameskoster.co.uk" target="_blank">http://www.jameskoster.co.uk</a> and Marko Mihel?i? - <a href="http://www.mcville.net--" target="_blank">http://www.mcville.net--</a>><br>
<br>
<head><br>
<br>
I cut off the rest.<span><font color="#888888"><br>
<br>
Michael.</font></span></blockquote></div></div></div></div></div></blockquote></div>-- <br>Silvio Clécio<br>My public projects - <a href="http://github.com/silvioprog" target="_blank">github.com/silvioprog</a><br>
</div></div>