Skip to main content
gamedev.net
🔒 Locked

Another CGI question...

Started by Evil Bill 4 replies 200+ views
Original Post
Evil Bill
Evil Bill
Does anyone know how to get the parameters passed to a C++ CGI program, if you call it like this: Test.exe?Number=42 ? The "Number=42" bit isn''t passed with the command line, its not an enviroment variable, and its not passed through stdin. Any ideas? Cheers, Steve Steve
DirectX Programmer
Soon to be the new Bill Gates
Member of the Unban Mindwipe Society (UMWS)
Evil Bill
Evil Bill
Thanks for the link, its got some usefull stuff in it. Unfortunately it doesn''t answer my question since every example there uses forms. My program really needs to have the data sent to it via a hyperlink: <a href="blah.exe?Number=42">Click here!</a>

Any ideas?

Cheers again,
Steve

Steve
DirectX Programmer
Soon to be the new Bill Gates
Member of the Unban Mindwipe Society (UMWS)
pieman
pieman
That info should be coming through in the QUERY_STRING environment variable. You also need to make sure that your program is correctly handling the difference between a GET request and a POST request (check env var REQUEST_METHOD). The hyperlink call is a GET request, whereas most forms use POST because it can handle more data.

Take a look here.
Iain HutchisonProgrammer, Silicon DreamsThe views expressed here are my own, not those of my employer.
moore52
moore52
<form action="http://xxx.xxx.xxx/xxx.exe" method="GET">
<input type="text" name="variable1">
<input type="text" name="variable2">
<input type="submit" value="FIND">
<input type="reset" value="CLEAR">
Evil Bill
Evil Bill
Ah, fenning. I''m an idiot
When i said it wasn;t comming in through an enviroment variable, i checked by purring a breakpoint at the getenv() function, and looking at the variable that is a list of all the enviroment variables. But of course to do that i have to be in Debug mode, which meant it wasn''t running on my HTTP server, so the CGI enviroment vars weren''t going into it. Oops

Thanks pieman, thats a good link.


Cheers,
Steve

Steve
DirectX Programmer
Soon to be the new Bill Gates
Member of the Unban Mindwipe Society (UMWS)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.