[GTALUG] Sending array variable over CGI ?
Myles Braithwaite 👾
me at mylesb.ca
Fri May 18 16:12:44 EDT 2018
William Park via talk wrote:
> How do I send array data, like A[1]=111, A[2]=222, A[3]=333 to a CGI
> script? I don't think I can do something like
> http://.../xxx.cgi?A[1]=111&A[2]=222&A[3]=333
> Or, can I?
>
> I have seen a same variable repeated,
> http://.../xxx.cgi?A=111&A=222&A=333
> but that means the CGI script has to build the array.
The square brackets aren't support HTTP characters, they are actually
considered unsafe and shouldn't be used.[0]
I have seen two ways of what you are asking for:
<http://example.com/endpoint/?A=111&A=222&A=333> and
<http://example.com/endpoint/?A_1=111&A_2=222&A_3=333>.
I don't see the issue with having to build an array for the values. If
the sender is sending an array the recipient should receive an array.
[0]: <https://perishablepress.com/stop-using-unsafe-characters-in-urls/>
More information about the talk
mailing list