cURL is a common line tool that will allow us to transfer data to a server using a specific protocol. 1
In our case, we'll use it to send HTTP request. 2
For that we can use the MobaXTerm terminal, but we can use any other Linux terminal with cURL 3
installed. 4
In MobaXTerm, click on start a local terminal. 5
We are now able to type most of the useful Linux command. 6
And if for other purposes than this course you can't find the command you need, then please go on the 7
package manager and check if it's available for this terminal. 8
By default, cURL sends to a server an HTTP GET request and print out the answer. 9
We can cURL Google for example. 10
We receive the content of the HTML front page. 11
I've got another server ready to receive HTTP request. 12
So let's try. 13
On the left. 14
I've got my MobaXTerm terminal. 15
It's from where I'm going to send HTTP request. 16
On the right. 17
I've got an HTTP server. 18
It will just print out the request it received, but it won't send any answer back to the client. 19
The command is easy. 20
It's curl, then I just need to specify the method I want to use with the -- request option. 21
In this 22
example, I will use an HTTP GET request. 23
If the type of request is not mentioned and the default one is GET. 24
But I want to write it down so we don't get confused. 25
Then I enter the server URL. 26
In my case, the server on the right has this address. 27
Finally, if you're getting annoyed with certificates, you can use the -- insecure option. 28
I launched a command, my server receives it, and it updates its log. 29
Really easy. 30
I can try another kind of request, which is the POST request. 31
So if I change, GET by POST, I've got the same kind of result, but this time with the POST method. 32
And finally, I can send some data in the request. 33
Let's say hello. 34
For that, I need to use the -- option with the content of my message. 35
And here we go, in the body section. 36
I've got my message. Later in this 37
course, when we'll have to send some request to a LoRaWAN server, 38
then we'll use these tools.