# CGI and posted variables

**URL:** <https://forum.xojo.com/t/cgi-and-posted-variables/9892>\
**Category:** General\
**Created:** [July 27, 2013, 8:46pm UTC](https://forum.xojo.com/t/cgi-and-posted-variables/9892 "2013-07-27T20:46:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Finance\_Dept](https://forum.xojo.com/letter_avatar_proxy/v4/letter/f/c5a1d2/32.png) [@Finance\_Dept](https://forum.xojo.com/u/Finance_Dept)\
**Post date:** [July 27, 2013, 8:46pm UTC](https://forum.xojo.com/t/cgi-and-posted-variables/9892/1 "2013-07-27T20:46:24Z")

</div>

I have a CGI application that I need to create. Its going to run on a Linux machine. Its fairly simply in that I’m going to be posting some variables to that CGI with some values, then returning some information.

I cannot for the life of me find anything to guide me in the right direction.

I see that RequestReceived is an event that I should include my code and logic, but I don’t know how to grab the posted variables and their values.  
I can’t find an example, nor can I find any documentation on this.

Can someone point me in the right direction?

Thanks,  
Gary  
ChannelBrain

---

<div class="post-metadata">

**Author:** ![Paul\_Lefebvre](https://forum.xojo.com/user_avatar/forum.xojo.com/paul_lefebvre/32/3152_2.png) [@Paul\_Lefebvre](https://forum.xojo.com/u/Paul_Lefebvre)\
**Post date:** [July 27, 2013, 9:05pm UTC](https://forum.xojo.com/t/cgi-and-posted-variables/9892/2 "2013-07-27T21:05:50Z")

</div>

It sounds like you might want to look at the [WebApplication.HandleSpecialURL](http://documentation.xojo.com/index.php/WebApplication.HandleSpecialURL) event.

---

<div class="post-metadata">

**Author:** ![Finance\_Dept](https://forum.xojo.com/letter_avatar_proxy/v4/letter/f/c5a1d2/32.png) [@Finance\_Dept](https://forum.xojo.com/u/Finance_Dept)\
**Post date:** [July 28, 2013, 6:54am UTC](https://forum.xojo.com/t/cgi-and-posted-variables/9892/3 "2013-07-28T06:54:50Z")

</div>

I’m trying to use a non-visual GUI… just a CGI app that I can post some variables to and do some processing on the server.

WebApplication is for WE, which would then throw a Web page up… not sure thats what I want.

I’m just trying to build a small CGI application to run and do some processing.

CGIApplication has a context, and it appears that you can get “Context HTTP.HTTPRequestContext” from the RequestReceived event when something calls that CGI… I have that part working.

My question is: Is there an example to pull the variables being posted from?

Is it coming from Context.Entity? Context.LoadVariables?

I just can’t find a damn thing about this in the documentation.

---

<div class="post-metadata">

**Author:** ![jim\_mckay](https://forum.xojo.com/user_avatar/forum.xojo.com/jim_mckay/32/905_2.png) [@jim\_mckay](https://forum.xojo.com/u/jim_mckay)\
**Post date:** [July 28, 2013, 5:27pm UTC](https://forum.xojo.com/t/cgi-and-posted-variables/9892/4 "2013-07-28T17:27:35Z")

</div>

You can get the variable values using context.variable(variableName as string)  
I don’t believe CGIApplication has any built in way to retrieve the names of all available variables.  
To get the names of the passed variables, you’d want to add a method to the HTTPRequestContext class

Function VariableNames() As string()  
dim sKeys() As String  
for each key as Variant in Variables.Keys  
skeys.Append key.stringValue  
next  
Return sKeys  
End Function

---

<div class="post-metadata">

**Author:** ![Finance\_Dept](https://forum.xojo.com/letter_avatar_proxy/v4/letter/f/c5a1d2/32.png) [@Finance\_Dept](https://forum.xojo.com/u/Finance_Dept)\
**Post date:** [July 28, 2013, 6:19pm UTC](https://forum.xojo.com/t/cgi-and-posted-variables/9892/5 "2013-07-28T18:19:12Z")

</div>

Thanks Jim, I’ll try that.

---

<div class="post-metadata">

**Author:** ![Finance\_Dept](https://forum.xojo.com/letter_avatar_proxy/v4/letter/f/c5a1d2/32.png) [@Finance\_Dept](https://forum.xojo.com/u/Finance_Dept)\
**Post date:** [August 7, 2013, 10:44pm UTC](https://forum.xojo.com/t/cgi-and-posted-variables/9892/6 "2013-08-07T22:44:04Z")

</div>

Just to follow up. That in fact worked… thanks Jim.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 4:46pm UTC](https://forum.xojo.com/t/cgi-and-posted-variables/9892/7 "2020-10-29T16:46:33Z")

</div>


