views:

211

answers:

1

I have been writing an HTTP server in C#, and I've gotten to the point where I want to implement PHP. However, I cannot seem to find a way to pass POST variables to the PHP-CGI executable. I know that I am supposed to use environment variables to communicate with the executable, and most importantly the QUERY_STRING variable. This one just seems to pass GET variables to PHP, not POST. I've also tried writing to the input stream of the executable, but it just ignores that completely. What am I missing?

A: 

You need to write to the input stream of the executable. Did you make sure to set the CONTENT_LENGTH environment variable?

Byron Whitlock
Well, I only recently found out that I should use environment variables with the executable, so I haven't really added any of them yet. Will PHP wait for me to write to the input stream if I specify the CONTENT_LENGTH?
Bevin
It shouldn't close the connection until content-length is received, or it timesout.
Byron Whitlock
I've tried adding the environment variable to the Process object, but it is still not working. When I looked at the keys in the dictionary of variables, they were all small letters. Are the variables case-sensitive?
Bevin
Perhaps I need to specify REQUEST_METHOD as well.
Bevin
Now it works! I needed to specify CONTENT_LENGTH and SCRIPT_FILENAME for it to work.
Bevin