I use an HTTP component in Borland Delphi 3.0 (old version Delphi). No Indy TIdHTTP
component available yet. Just using HTTP components.
I use POST
and GET
to process a form of registration for my program application (Radio Calculator v3.50).
My program
The plan is here.
POST form:
Include Username
, Email
, Phone number
, and JPG file
(transfer to my account) --> there are 4 parameters.
First, I use POST
for "processing" the different KEY
s for every different Username
. This is processed in my Web Server using PHP and Microsoft Access MDB as the database.
I use another HTTP process from Delphi (GET
), a few minutes later (let's says 15 minutes), to get a Username
and KEY
of the registration person in their home, or wherever they are around the world.
They will get DATA
automatically from my Web Server using PHP.
My questions:
How can I use
POST
andGET
commands in HTTP Delphi Components? With all 4 parameters I use simple coding here from a similar post:function PostExample: string; var lHTTP: TIdHTTP; lParamList: TStringList; begin lParamList := TStringList.Create; lParamList.Add('id=1'); lHTTP := TIdHTTP.Create; try Result := lHTTP.Post('http://blahblahblah...', lParamList); finally lHTTP.Free; lParamList.Free; end; end;
How can I process the
POST
andGET
result? What variables will be filled with this syntax? And how can I use this for further processing?Will this procedure work fine, or is there some leakage in securities in it?
I use
POST
HTTP, sending these parameters, process it using PHP in my Web Server, and I get the raw result usingGET
a few minutes later. Is there anything I missed in the procedure? ShouldGET
be instantly requested afterPOST
, or how should I do it? Should I change HTTP toTWebBrowser
only? Just make a Web Browser in Delphi? So I don't have to think hard about the HTTP process, only use my PHP programming competency instead?
How coding uses TIdHTTP.Post()
to PHP:
procedure TForm1.Button1Click(Sender: TObject);
Var
params : TStringList;
res : TStringStream;
begin
params := TStringList.Create;
params.Add('a='+'hello');
res := TStringStream.Create('');
idhttp1.Post('http://localhost/test/hallo.php', params, res);
ShowMessage(res.DataString);
res.Free;
params.Free;
end;
<?php
echo $_POST['a'];
%>
i ve UPLOAD IT IN GITHUB NGAB. Here 100% Works
Result
in your example is just astring
, it will receive whatever raw text the server decides to send back to you (ie, HTML, JSON, XML, etc). There are no "parameters" in thatResult
from Indy's perspective. You will have to parse thatstring
yourself to extract whatever data you need from it.