Fergo Posted September 9, 2008 Share Posted September 9, 2008 Hey everyone, it's my first post in here. I'm programming a simple webserver and I'm trying to implement php support to it. I'm getting some troubles when parsing a php file with arguments. I have the following php file (test.php) in the same folder of php.exe: <html > <head> <title>MyPage</title> </head> <body> <?php $test = $_GET['fergo']; echo($test); ?> </body> </html> I don't know how to pass the php arguments to php.exe (test.php?fergo=hello for example). I was trying to do this: php.exe -f test.php -- fergo=hello By doing this, php.exe gave me the error: PHP Notice: Undefined index: fergo in C:\Documents and Settings\Fernando\Deskt op\php-5.2.6-Win32\teste.php on line 8 How can I pass the arguments to php.exe so it can parse the $_GET correctly? Thanks in advance, Fergo Link to comment https://forums.phpfreaks.com/topic/123468-passing-arguments-to-phpexe/ Share on other sites More sharing options...
cooldude832 Posted September 9, 2008 Share Posted September 9, 2008 GET and POST are http ways to pass data so using it in a command line will not work Link to comment https://forums.phpfreaks.com/topic/123468-passing-arguments-to-phpexe/#findComment-637677 Share on other sites More sharing options...
Fergo Posted September 9, 2008 Author Share Posted September 9, 2008 Thanks for the fast answer. In this case, how PHP (or who?) process this kind of situation? How the php parser knows the values of GET/POST variables so it can process the file and return the result to the server? Fergo Link to comment https://forums.phpfreaks.com/topic/123468-passing-arguments-to-phpexe/#findComment-637689 Share on other sites More sharing options...
cooldude832 Posted September 9, 2008 Share Posted September 9, 2008 I believe the query strings for GET and POST are processed via apache to the php engine/phraser which in turn develops its own superglobal array from the CSV style list from the query strings. So you really don't see the translation working on PHP in a server enviroment because its seamless to the user Link to comment https://forums.phpfreaks.com/topic/123468-passing-arguments-to-phpexe/#findComment-637696 Share on other sites More sharing options...
Fergo Posted September 9, 2008 Author Share Posted September 9, 2008 Thanks cooldude. So the query strings are processed by the web server itself and then they are sent to php parser in other format, right? Do you know where I can get more information about this (which format this is, where the parser will look for the query strings, etc)? I tried php docs, but I don't know exactly what to search. Again, thanks a lot. Fergo Link to comment https://forums.phpfreaks.com/topic/123468-passing-arguments-to-phpexe/#findComment-637714 Share on other sites More sharing options...
Fergo Posted September 9, 2008 Author Share Posted September 9, 2008 I've managed to pass the GET variables to the parser using php-cgi.exe: php-cgi.exe -f test.php -- fergo=hello This worked fine. But now I don't how to do the same with POST. Any ideas? Fergo Link to comment https://forums.phpfreaks.com/topic/123468-passing-arguments-to-phpexe/#findComment-637769 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.