Hello i try to append strings and i can´t get it. i am a c++ greenhorn.
The append should be happen in the subfunction, in line : pushingbox(server …
I want to bring together, the received “data” value with the “url” , to trigger a pushinbox scenario.
const char server = "api.pushingbox.com";
const char url_who_open_house_door[] = "/pushingbox?devid=xxxxxxxxxxxxxx&user="; // xxx hide my pushingbox ID
void setup(){
// here i listen for the response by a google sheet
Particle.subscribe("hook-response/postGoogle", subKeyCodeCheckResponse, MY_DEVICES);
}
void loop() {
}
void subKeyCodeCheckResponse(const char *event, const char *data) { // the value of "data" is for example "unlocked by Ghostbusters"
if(strstr(data, "unlocked")){
digitalWrite(led, HIGH);
pushingbox(server, url_who_open_house_door ); // trigger pushingbox.com scenario, added with one own variable/value "user"
digitalWrite(led, LOW);
}
}
//*********************************************************
//*** sendGetRequest()
//*********************************************************
void pushingbox(const char * server, const char * url)
{
if (myTCP.connect(server, 80)) {
myTCP.print( "GET ");
myTCP.print(url);
myTCP.println(" HTTP/1.0");
myTCP.println("Connection: close");
myTCP.print( "Host: ");
myTCP.println(server);
myTCP.println("Accept: text/html, text/plain");
myTCP.println();
myTCP.flush();
delay(250);
myTCP.stop();
}
}