esp_http_client

User avatar
arunbm123
Posts: 24
Joined: Fri Feb 23, 2018 5:36 am

esp_http_client

Postby arunbm123 » Tue Dec 25, 2018 12:38 pm

hello friends

I am trying esp_http_client example

I want to post some Data.

Here is the Code..........
************************************************************************************************************************************************
esp_http_client_config_t config = {
.url="http://someurl.com?id=var",
.event_handler = _http_event_handler,
.timeout_ms = 5000,
};
esp_http_client_handle_t client = esp_http_client_init(&config);
esp_err_t err;
const char *post_data = "i am running test data and example";
esp_http_client_set_method(client, HTTP_METHOD_POST);
esp_http_client_set_post_field(client, post_data, strlen(post_data));
while (1) {
err = esp_http_client_perform(client);
if (err != ESP_ERR_HTTP_EAGAIN) {
break;
}
}
************************************************************************************************************************************************

How do I set the form Variable so that I can receive the data like $data = $_POST['data'] in php file

Thanks
Arun

chegewara
Posts: 625
Joined: Wed Jun 14, 2017 9:00 pm

Re: esp_http_client

Postby chegewara » Tue Jan 08, 2019 12:44 pm

Hi,
post_data is just a string like in postman or any POST request:

Code: Select all

data=value&data=value2

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 17 guests