Hello. I have a piece of hardware called an esp32 chip. It is taking sensor data and I am able to send that data to a local host site. I would like to send the data to my paid python anywhere account.
Below is hopefully enough information to show how I successfully send data to my local host site.
ESP32 Code is in C++, but has the info needed for a successful POST to my local site
const uint16_t port = 5000;
const char * host = "10.0.0.222";
after sensor data is received (client is a c++ class)
if (!client.connect(host, port)) {
Serial.println("Connection failed.");
Serial.println("Waiting 5 seconds before retrying...");
delay(5000);
return;}
String PostData="my_data_string";
client.println("POST /echo HTTP/1.1");
client.println("Host: ESP32");
client.println("User-Agent: Arduino/1.0");
client.println("Connection: close");
client.println("Content-Type: application/x-www-form-urlencoded; charset=UTF-8");
client.print("Content-Length: ");
client.println(PostData.length());
client.println();
client.println(PostData);
client.stop();
python code
@app.route('/echo', methods=['GET', 'POST'])
def echo():
if request.method == 'POST':
dataIncoming = json.loads(request.values['esp32'])
I'm hoping it would be as easy as replacing some of the info, like port number etc... , in the C++ code. Thanks!