ThingSpeak esp8266 as wifi shield

which esp8266 library should i use for this setup? how about ESP8266_Lib.h library?

in thw blynk docs tutorial for webhook said adding this code:

WiFiClient client;
if (client.connect("api.thingspeak.com", 80)) {
    client.print("POST /update HTTP/1.1\n");
    client.print("Host: api.thingspeak.com\n");
    client.print("Connection: close\n");
    client.print("X-THINGSPEAKAPIKEY: " + apiKeyThingspeak1 + "\n");
    client.print("Content-Type: application/x-www-form-urlencoded\n");
    client.print("Content-Length: ");
    client.print(postStr.length());
    client.print("\n\n");
    client.print(postStr);
}

but i realize this "WiFiClient is for ESP8266 standalone. so i dont know how to code to send data to thingspeak using esp8266 as wifi shield ( esp8266 + arduino mega). i use ESP8266_Lib.h but get an error (“WiFiClient does not name a type”) . help me to solve this problem…thanks!

@alexanderisz actually if you read the docs again what it states is the code you have provided would be needed if Blynk didn’t exist.

Blynk does exist. Study Webhooks closer.

ohh… my bad… so, how to send more than 1 data to thingspeak with one webhook widget. as example i want to send V1 & V2 to thingspeak…

You would need 2 Webhooks but virtual pins can hold arrays of data.

So whatever you have in V1 and V2 can all be in V1 (or V3 if you prefer).

As per docs you then use the array elements in Webhook as:

You can also refer to specific index of multi value pin (multi pin supports up to 5 values) :
/pin[0]/,/pin[1]/, /pin[2]/

I think 5 was possibly increased to unlimited by the Blynk developers.