Webduino - POST/GET to an Array - Like PHP

Hi,

Is there a way to make Webduino put the POST/GET commands to an Array just like in PHP?

Example: in php you could have the following (GET as example)

GET: /index.htm?a=1&b=2&c=3 , so if you called $_GET["a"] it would return 1, $_GET["b"] would return 2.

Now, is there any way to do it within the loop during the nextURLparam? so I could set an array called GET and then read it later on.

Example, what I'd like to do is this:

  if (strlen(url_tail))
  {
    server.printP(Parsed_tail_begin);
    while (strlen(url_tail))
    {
      rc = server.nextURLparam(&url_tail, name, NAMELEN, value, VALUELEN);
      if (rc == URLPARAM_EOS)
        server.printP(Params_end);
      else
      {
        server.print(name);
        server.printP(Parsed_item_separator);
        server.print(value);
        server.printP(Tail_end);
        [b]GET[name] = value;[/b]
      }
    }
  }

To have such a functionality you would have to first implement some kind of associative arrays, a concept widely accepted in most script languages in the PC/web server field. In the low end embedded world (which Arduino is part of) you haven't the memory available that concepts like this usually requires. An Arduino UNO has 2kB of memory, every variable and the call stack has to fit within that too, so you simply don't have enough memory to use a storage concept like this.

You probably even have a problem with storing the whole URI in a string because making the the URL a bit longer when calling your Arduino server will immediately reset it because it runs out of memory.

The usual way is to parse the string as it comes in and store only the values you're interested in, forgetting everything else immediately after.

You have to be prepared for this limitations when programming for the Arduino (or any other MCU platform) and think a bit differently than you would on the more powerful machines with operating systems.