Configuration Parameter |
Selectable Option/Value |
Description |
HTTP Method |
GET--POST |
Specify the request type |
Response buffer size |
32--64--128--256--512--1024--2048--4096 |
Select the response buffer size |
Enable semaphore control for HTTP block |
Check--Uncheck |
Having multiple HTTP blocks in the same model file can cause errors during run time. In such case this parameter should be enabled. |
Input method |
From input port-- From circular buffer |
Specify the Input method of input message for the POST method |
Sample time (sec) |
-1 (inherited) or specify |
Specify sample time for the block |
Port Name |
Port Type |
Date Type |
Description |
URL |
Vector |
uint8 |
URL of the destination server the data to be transmitted |
POST Data |
Scalar/Vector |
uint8 |
Data which is to be transmitted |
HTTP response code |
Vector |
uint8 |
HTTP response status codes indicate whether a specific HTTP request has been successfully completed |
Response data |
Scalar/Vector |
uint8 |
Data receive by the server |
Port Name |
Port Type |
Date Type |
Description |
URL |
Vector |
uint8 |
URL of the destination server the data to be transmitted |
HTTP response code |
Vector |
uint8 |
HTTP response status codes indicate whether a specific HTTP request has been successfully completed |
Response data |
Scalar/Vector |
uint8 |
Data receive by the server |
This block can be used to send GET or POST HTTP requests.
Demo file : esp32_http_client_demo.slx
The full model
The GET request subsystem
The POST request subsystem
This example will demonstrate how to use the WiFi block to initialize the WiFi in station mode and send the GET and POST requests to the web servers using HTTP client block via the internet. This uses a Echoserver to test the HTTP Client Block.
so a HTTP client block can send a message to the server and the server can receive the message and send, or echo, it back to the HTTP client block.
Note:
•Please insert valid SSID and Password to the WiFi setup block.
•The serial monitor used for this application is the Putty software which is open source application.
•Baud Rate: 115200
Use a serial communication monitor software to test this demo. Select the correct COM port in the software to monitor the data. The GET and POST response data will be shown in the host PC as below