How I can make a GET request on this example?
http://localhost:9000/api/public/v1/action=X
I tried with TIdHTTP
but only the 80 port its acceptable and when I try the 9000 port this error happen:
Unknow protocol
My code:
var
lHTTP: TIdHTTP;
link: String;
begin
link := 'localhost:9000/api/scanner/Acao?acao=x';
lHTTP := TIdHTTP.Create;
try
link := lHTTP.Get(link);
finally
lHTTP.Free;
end;
end;
TIdHTTP
should work fine with non-standard ports, provided you actually have an HTTP server listening on localhost
on port 9000
, eg:
var s: string;
s := IdHTTP1.Get('http://localhost:9000/api/public/v1/action=X');
The only way to get an "Unknown protocol" error is if you omit the scheme portion from the URL, eg:
s := IdHTTP1.Get('localhost:9000/api/public/v1/action=X');
You must include either http://
or https://
in the URLs you request.