http.GET() response -2 but data are sent properly | ESP Wi-Fi | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
http.GET() response -2 but data are sent properly
No permission to create posts
December 27, 2017
2:14 pm
Avatar
alcapar
New Member
Members
Forum Posts: 3
Member Since:
December 27, 2017
sp_UserOfflineSmall Offline

I need to check data are correctly handled. Now I try to get httpcode and always returns -2 but data are sent properly. The code is:

if (client.connect("api.thingspeak.com",80)) {
writeAPIKey = "key=XXXXXXXXXXX";
tsfield1Name = "&field1=10";
request_string = thingSpeakAddress;
request_string += "key=";
request_string += "XXXXXXXXXXXX";
request_string += "&";
request_string += "field5";
request_string += "=";
request_string += (tempe);
http.begin(request_string);
http.GET();
int httpCode = http.GET();
Serial.println(httpCode);
String payload = http.getString(); //Get the request response payload
Serial.println(payload);
http.end();

I am sure something is wrong.

December 28, 2017
9:27 pm
Avatar
Vinod

MathWorks
Members
Forum Posts: 258
Member Since:
May 1, 2016
sp_UserOfflineSmall Offline

Perhaps you want to try modifying one of the many examples listed here:

https://www.mathworks.com/help/thingspeak/examples.html

December 31, 2017
12:50 pm
Avatar
alcapar
New Member
Members
Forum Posts: 3
Member Since:
December 27, 2017
sp_UserOfflineSmall Offline

Thank you, I did it and it works.

Smile

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
19 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

Richard, naturepur, Nimper, kaplan@sor.cz, projectid030, mrlee234

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457