The Wireless Universal Resource File

The Wireless FAQ

7.14 How much data can I send back to the server using GET or POST?

The amount of data you can send back using a GET or POST seems to be device dependent. A GET transfer (aka a request) sends variables on the URL, and the amount of data that can be sent is much less than what you can send using a POST. For instance, the Nokia 7110 seems to have a GET limit of very close to 512 bytes, while it handles POSTs up to the max size of the compiled deck (aprox 1300 bytes). The UP.SDK 4.0 has a limit of some 970 bytes using GET and up to the max size of a compiled deck for a POST.

Obviously, the card sometimes hold the contents of the variable(s) that are sent to the server, and since there is a compiled deck size limit, this will influence the total amount of data you can transfer.

There's not much difference between doing a POST or a GET. The following is an example of the common, but not very pretty way using GET.

>
<input type="text" name="var1" format="*N"/>
<p>
  <anchor>Send it
  <go href="somescript.cgi?variable=$(var1)" method="get"/>
  </anchor>
</p>
And the following; still a GET request, but using <postfield> to set the variables which makes for much prettier code, and since it's almost identical to a POST, easy to change from a GET to a POST.

>
<input type="text" name="var1" format="*N"/>
<p>
  <anchor>Send it
  <go href="somescript.cgi" method="get">
    <postfield name="variable" value="$(var1)"/>
  </go>
  </anchor>
</p>

And then a straight POST.

>
<input type="text" name="var1" format="*N"/>
<p>
  <anchor>Send it
  <go href="somescript.cgi" method="post">
    <postfield name="variable" value="$(var1)"/>
  </go>
  </anchor>
</p>

To find out exactly how much data you can transfer, it's down to testing, and for this purpose there is a test application available. The application is also available in the Demos Section.

The application will generate a card that contains one variable called a which contains the specified number of the character x. You can choose between sending this variable to the server using GET or POST. After sending the data, the script will display the number of bytes it received and the content type of the data it received.

The script generated deck that is used to send the data to the server in the above test application looks exactly like this, except that where it says "GET" it will say "POST" if you've chosen to POST, and the number of X's will reflect the number of bytes you specified:

>
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://...">
<wml>
<head>
  <meta forua="true" http-equiv="Cache-Control" content="max-age=0"/>
  <meta forua="true" http-equiv="Cache-Control" content="must-revalidate"/>
</head>
<card>
  <do type="prev" label="Back">
    <go href="putsize.php3"/>
  </do>
    <p>
    <anchor>GET data
    <go method="get" href="putsize.php3">
      <postfield name=\"a\" value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"/>
    </go>
    </anchor>
    </p>
  </card>
</wml>
[ Main ]   [ 07 - Making it look fancy ]