Hi,
Is getting HTTPSender.ResultCode:500 InternalServer Error with following
code that works good in Crome and IE on PC.
Developing in Lazarus 1,1 and FPC 2.7.1.
procedure TfrmOSMMain.btnSearchClick(Sender: TObject);
var
HTTPGetResult: Boolean;
HTTPSender: THTTPSend;
URL, TargetFile : string;
tempList : TStringList;
begin
tempList := TStringList.Create;
HTTPSender := THTTPSend.Create;
try
URL := '
http://api.geonames.org/search?q=london&maxRows=10&username=demo';
HTTPSender.MimeType := 'text/plain; charset=UTF-8';
HTTPGetResult := HTTPSender.HTTPMethod('GET', URL);
Label1.Caption := 'HTTPSender.ResultCode: ' +
IntToStr(HTTPSender.ResultCode);
if (HTTPSender.ResultCode >= 100)and
(HTTPSender.ResultCode <= 299) then
begin
tempList.LoadFromStream(HTTPSender.Document);
// HTTPSender.Document.SaveToFile(TargetFile);
Label1.Caption := Label1.Caption + lineEnding + tempList.Text;
end;
finally
HTTPSender.Free;
FreeAndNil(tempList);
end;
If I set an explicit IP-address to a custom server it works, so I guess it
is a problem caused by failed DNS-lookup as
there don't seem to be any attempt to establish a connection.
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public