kopia lustrzana https://github.com/martin-ger/esp_mqtt
added http_post
rodzic
dbcb7ca6b8
commit
ce86663aed
|
@ -44,6 +44,7 @@ In general, scripts conform to the following BNF:
|
|||
settimer <num> <expr> |
|
||||
setvar ($[any ASCII]* | @<num>) = <expr> |
|
||||
http_get <expr> |
|
||||
http_post <expr> <expr> |
|
||||
gpio_pinmode <num> (input|output) [pullup] |
|
||||
gpio_out <num> <expr> |
|
||||
gpio_pwm <num> <num> |
|
||||
|
@ -149,7 +150,12 @@ Flash variables can also be used for storing config parameters or handing them o
|
|||
```
|
||||
http_get <expr>
|
||||
```
|
||||
Sends an HTTP request to the URL given in the expression.
|
||||
Sends an HTTP GET request to the URL given in the expression.
|
||||
|
||||
```
|
||||
http_post <expr> <expr>
|
||||
```
|
||||
Sends an HTTP POST request to the URL given in the first expression with the post data from the second expression.
|
||||
|
||||
```
|
||||
gpio_pinmode <num> (input|output) [pullup]
|
||||
|
|
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
|
@ -1,2 +1,2 @@
|
|||
6a34ad8fa228aea1d144d4c3f193a90b49d27c53 0x00000.bin
|
||||
75e586b61a2a6924d1e6186d8b0a466cc2063a61 0x10000.bin
|
||||
7d439d81815850d151040d962e550f17cc914e19 0x00000.bin
|
||||
06c6e4b1e89a1cc0ddaf8c91265e9eac35253a02 0x10000.bin
|
||||
|
|
27
user/lang.c
27
user/lang.c
|
@ -943,6 +943,33 @@ int ICACHE_FLASH_ATTR parse_action(int next_token, bool doit) {
|
|||
http_get(url_data, "", interpreter_http_reply);
|
||||
}
|
||||
}
|
||||
|
||||
else if (is_token(next_token, "http_post")) {
|
||||
len_check(2);
|
||||
|
||||
char *url_data;
|
||||
int url_len;
|
||||
Value_Type url_type;
|
||||
if ((next_token = parse_expression(next_token + 1, &url_data, &url_len, &url_type, doit)) == -1)
|
||||
return -1;
|
||||
|
||||
// Copy, in case it is in tmp_buffer
|
||||
if (!doit)
|
||||
url_len = 0;
|
||||
char post_url[url_len+1];
|
||||
os_memcpy(post_url, url_data, url_len);
|
||||
post_url[url_len] = '\0';
|
||||
|
||||
char *post_data;
|
||||
int post_len;
|
||||
Value_Type post_type;
|
||||
if ((next_token = parse_expression(next_token + 1, &post_data, &post_len, &post_type, doit)) == -1)
|
||||
return -1;
|
||||
|
||||
if (doit) {
|
||||
http_post(post_url, post_data, "", interpreter_http_reply);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef GPIO
|
||||
else if (is_token(next_token, "gpio_pinmode")) {
|
||||
|
|
Ładowanie…
Reference in New Issue