Arduino webserver read get command

Hi all
I'm trying to create a small web server that reads a get command ex I send http://192.168.1.31?distance=5 where my arduino server is 192.168.1.31 and I need to read the value of distance.
I'm using WiFiNINA.h libary.

Can any one help me with this?

Have you tried the SimpleWebServerWiFi example of the WiFiNINA library? It should give you enough hints how you can get your project realized.

Hi tanks for you r reply
Yes I have, but there are no easy way to to this and I think I'm missing something....
I'm getting crazy... sorry...

Yes I have, but there are no easy way to to this and I think I'm missing something....

That example does almost the same as you're trying to do. Minimal modifications are necessary. Don't expect us to do your job, this is not a free programming service.

What kind of answer is that, please behave.

I don't expect a full code response, I just need to know if there is a smartere way do do this.

I normally code in C# and there are some more smart ways to do this.

mskovborg:
Hi all
I'm trying to create a small web server that reads a get command ex I send http://192.168.1.31?distance=5 where my arduino server is 192.168.1.31 and I need to read the value of distance.
I'm using WiFiNINA.h libary.

Can any one help me with this?

Well, it depends on the library being used and its functions, and the functions are used in the code. The below is what is typically sent by a client to a server, with the data in the first line being of interest. Usually that first line is captured as a c-string or String, then various operations are used to extract the desired data. In your example "GET ?distance=5 HTTP/1.1" would probably be the first line. With the line being captured as a String, a String function could extract the data between the = and the next blank space and save that as a variable, which could be used or displayed. In this case it would be the "5".

GET /2/on HTTP/1.1
Accept: text/html, application/xhtml+xml, image/jxr, */*
Accept-Language: en-US
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko
Accept-Encoding: gzip, deflate
Host: 192.168.0.2
DNT: 1
Connection: Keep-Alive

Hi zoomkat
Thanks for your reply.
It looks like C is missing some lib's to make life easy for programmers :frowning:
I will take a look into a way to split the string and get the values.

Have a fantastic day.