• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 224
  • Last Modified:

standard posting method to cgi - programs

hi
id like to know is there a standard format of how to pass query strings and post data to a cgi- program spicifically php
i currently call php like

php.exe phpscript "query strings"

from cmd

but i have no idea of how to pass posted data to the program do i send a file handle or something??

regards mark,
0
mgazza
Asked:
mgazza
  • 5
  • 3
1 Solution
 
ahoffmannCommented:
php uses the CGI as usual, means that the query string is passed in as environment variable QUERY_STRING (GET data) and POST data is passed in on STDIN

POST:
  echo variable=value | php.exe script.php

GET:
  set QUERY_STRING="variable=value"
  php.exe script.php
0
 
mgazzaAuthor Commented:
would i set the envar for the program or the system? if you have any example code c or anything that would be gr8
my server is currently showing querystrings (get data) oka
example php

{{ link to phpinfo.php removed for security reason }}
{{ ahoffmann wearing my Page Editor hat }}


regards mark
0
 
mgazzaAuthor Commented:
:/
 ill just post the data as a html then :P

http://mgazza.kicks-ass.net/phpinfo.html

happy now :P

just look @ PHP Variables

just to show wat my server is currently passing

regards mark,
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
ahoffmannCommented:
mgazza, phpinfo.php does not give much valuable information about the called script
It also exposes your whole server, in particular the security holes, that's why the link have been removed.

in PHP you get the passed variables in $_GET[] and/or $_POST[]
For security reason only use these arrays (the one you expect the data) and not $_REQUEST[]

Does this answer your question?
0
 
mgazzaAuthor Commented:
no sorry im tring to figure out how to post data to php or any cgi script,

currently my server(not iss or apache or anything) calls php.exe passes the script and query string which appears in $_REQUEST[] and $_GET[]

i have no idea of how to pass the posted data.

my server calls createprocess and passes the data there

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createprocess.asp

should i pass the get strings there there is no way to write to std in as far as i know

best regards
mark

ty for your help so far
0
 
ahoffmannCommented:
hmm, stupid API, I don't see how to pass data on STDIN
Either you need to rewrite your script.php to accept all data in environment
or use a web server which supports PHP natively
or ask the developers how to do what you want (which is the usal way)
0
 
mgazzaAuthor Commented:
yea thats wat i keep tryin to do hehe! there is a write handle in createpipe() but php isnt listenin to it when i write to it. i wish there was some standard way of doin this lol!
dlls would also be much better to use than exes much more memory resiliant and faster.

i use my own web server cause i can make it do what ever i want you see. and i know the security holes if there is any so its much harder for people to get into.

regards mark,

ill leave this qa open for afew days thanks for your help!
0
 
mgazzaAuthor Commented:
sorry i forgot about this question :D

thanks alot
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now