This is my code which is copied from " GSM-ParticulateSensor" example
void thingspeakPost() {
char itoaBuffer[8];
char end_c[2];
end_c[0] = 0x1a;
end_c[1] = '\0';
// PM25 int to char
char data25[50];
String str25;
str25 = String(Pm25);
str25.toCharArray(data25, 50);
// PM10 int to char
char data10[50];
String str10;
str10 = String(Pm10);
str10.toCharArray(data10, 50);
if (inet.connectTCP(thingSpeakAddress, 80)) {
Serial.println("connected to thingspeak");
gsm.SimpleWrite("POST /update HTTP/1.1
");
gsm.SimpleWrite("Host: api.thingspeak.com
");
gsm.SimpleWrite("Connection: close
");
gsm.SimpleWrite("X-THINGSPEAKAPIKEY:");
gsm.SimpleWrite(writeAPIKey);
gsm.SimpleWrite("
");
gsm.SimpleWrite("Content-Type: application/x-www-form-urlencoded
");
gsm.SimpleWrite("Content-Length: ");
sprintf(sentMsg, "field1=%s", data25);
itoa(strlen(sentMsg), itoaBuffer, 10);
gsm.SimpleWrite(itoaBuffer);
//inet.httpPOST("api.thingspeak.com", 80, "/update?key=B325M1U9WB2JGC9Z&field1= itoaBuffer");
//gsm.SimpleWrite("PUT https://api.thingspeak.com/channels/137269/api_key=K9WNHI32J4346GL6");
// gsm.SimpleWrite(" api_key=K9WNHI32J4346GL6");
// gsm.SimpleWrite(" name=Updated Channel");
//gsm.SimpleWrite(Pm25);
gsm.SimpleWrite("
");
gsm.SimpleWrite(sentMsg);
gsm.SimpleWrite("
");
gsm.SimpleWrite(end_c);
delay(20000);
Serial.println("update to thingspeak");