Post tO HTTPS
Posted: Mon Apr 04, 2022 4:51 pm
Hi,
I need some help, I´m making a post to an URL which is uses HTTPS, previously I was using POST in a HTTP but
when it changed to HTTPS the POST couldn´t be send, what should I change or add to my POST code?
Kind Regards,
Fredy
/*********************************Post Code*************************************************/
bool sendStatus() {
char postObjStr[1024];
ParsedJsonDataSet JsonOutObject;
ParsedJsonDataSet JsonInObject;
JsonOutObject.StartBuilding();
JsonOutObject.Add("action", "aeiCommand");
JsonOutObject.Add("command", "integraAeiProcessLogData");
JsonOutObject.Add("userId", "Integra");
JsonOutObject.DoneBuilding();
logg.newPrint("\nStatus out: ");
JsonOutObject.PrintObjectToBuffer(postObjStr, 1024);
logg.newPrint(postObjStr);
ParsedURI uri(getUrl("integraAeiProcessLogData"));//get the server url
//send the post Object (JsonOutObject) and obteins the server answer into JsonInObject
bool result = DoJsonPost(uri, JsonOutObject, JsonInObject, NULL,10 * TICKS_PER_SECOND);
//print JSON result
logg.newPrint("\nStatus in: ");
if(result){
memset(postObjStr,'\0',1024);
JsonInObject.PrintObjectToBuffer(postObjStr, 1024);
logg.newPrint(postObjStr);
}else{
logg.newPrint("POST could not be sent\n");
}
return result;
}
I need some help, I´m making a post to an URL which is uses HTTPS, previously I was using POST in a HTTP but
when it changed to HTTPS the POST couldn´t be send, what should I change or add to my POST code?
Kind Regards,
Fredy
/*********************************Post Code*************************************************/
bool sendStatus() {
char postObjStr[1024];
ParsedJsonDataSet JsonOutObject;
ParsedJsonDataSet JsonInObject;
JsonOutObject.StartBuilding();
JsonOutObject.Add("action", "aeiCommand");
JsonOutObject.Add("command", "integraAeiProcessLogData");
JsonOutObject.Add("userId", "Integra");
JsonOutObject.DoneBuilding();
logg.newPrint("\nStatus out: ");
JsonOutObject.PrintObjectToBuffer(postObjStr, 1024);
logg.newPrint(postObjStr);
ParsedURI uri(getUrl("integraAeiProcessLogData"));//get the server url
//send the post Object (JsonOutObject) and obteins the server answer into JsonInObject
bool result = DoJsonPost(uri, JsonOutObject, JsonInObject, NULL,10 * TICKS_PER_SECOND);
//print JSON result
logg.newPrint("\nStatus in: ");
if(result){
memset(postObjStr,'\0',1024);
JsonInObject.PrintObjectToBuffer(postObjStr, 1024);
logg.newPrint(postObjStr);
}else{
logg.newPrint("POST could not be sent\n");
}
return result;
}