Im using the synapse lib and i want to send a String to a PHP Api via http post.
This is my final json string which i want to send via http post to the API.
{"os":"Windows7", "architecture":"64", "date":"20.06.2013", "version": "3.22", "name":"TestVM-PC"}
var sSendString: String;
sSendString := '{"os":"Windows7", "architecture":"64", "date":"20.06.2013", "version": "3.22", "name":"TestVM-PC"}';
I found this sample procedure to post parameters, but i don't know how send now correctly one JSON String (sSendString) to the API.
procedure HTTPPost;
var URL: string;
Params: string;
Response: TMemoryStream;
begin
Response := TMemoryStream.Create;
try
URL := 'http://testserver.com/api/add_customer';
Params := 'parameter1=' + EncodeURLElement('data1') + '&' +
'parameter2=' + EncodeURLElement('data2');
if HttpPostURL(URL, Params, Response) then
Response.SaveToFile('c:\response.txt');
finally
Response.Free;
end;
end;
So can someone help me to fixx my problem and show which lines i have to change to send my json string to the API. Thanks in Advance