Home » Community » Newbie corner » skylark with server and client
Re: skylark with server and client [message #56055 is a reply to message #56048] |
Tue, 19 January 2021 10:31   |
 |
Xemuth
Messages: 387 Registered: August 2018 Location: France
|
Senior Member |
|
|
Hello BetoBValle :
Request from client :
HttpRequest http("http://localhost:8001/serverSkylark/qualqueres");
// http.POST().Header("id","1234"); //Via request header
// http.POST().Post("id","1234"); //Via post Data
http.POST().PostData("{\"id\":\"1234\"}"); //Via post data formated in JSON
Cout() << http.Execute() << EOL;
Code to return 1234 from server :
SKYLARK(q, "qualqueres:POST")
{
//String c = http.GetHeader("id"); //Via request header
//String c = http["id"]; //Via post data
String c;
String dataNotParsed = http.GetRequestContent(); //Via Post data formated in JSON
Value json = ParseJSON(dataNotParsed);
if(!IsNull(json["id"]))
c = json["id"];
http << c;
}
[Updated on: Tue, 19 January 2021 10:32] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Tue Apr 29 09:54:49 CEST 2025
Total time taken to generate the page: 0.05711 seconds
|