Re: Can't fetch HTTP POST data in PHP?

From: Date: Sun, 16 Nov 2003 12:05:32 +0000
Subject: Re: Can't fetch HTTP POST data in PHP?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-169813@lists.php.net to get a copy of this message
Hello. On Sat, Nov 15, 2003 at 05:31:01PM -0800, Chris Shiflett wrote: > That does seem strange. I glanced at this page of yours: > > > http://zonk.matfyz.cz/php_post_problem > > And I saw this: > > REQUEST_METHOD => GET > So, why was the request a GET request rather than a POST request? There is > no content nor any entity headers either, so it doesn't seem like this > line (telling us that the request method was GET) is wrong. Sorry for that. Somehow me or my web browser tricked me into thinking I saved the right file. There's a correct one now. I screwed it when I was trying the GET method or whatever. Nonetheless it still does not work. Neither with GET nor with POST. If you liked to glance a little bit more maybe you'd like to see the request http://zonk.matfyz.cz/request It's the one used with the POST method. I sent this request to the server with netcat and saved (hope that the right one that time:) the result into http://zonk.matfyz.cz/php_post_problem again. > However, I also don't see any URL variables, so it doesn't seem like the > HTTP request contained any form data, whether GET or POST. Whoa. What kind of variables did you say? Ok. This is what I thought: I have a nonapache - boa - webserver, maybe it's POST handling could be different. (That would be even more strange but maybe boa webserver does not set these variables) So I'll try GET. You know how it ended. The same way. > echo $username; > echo $_GET['username']; > echo $_POST['username']; > echo $_REQUEST['username']; > echo $_SERVER['QUERY_STRING']; Ok. I've put this little code of yours after var_dump($_GET): array(0) { } Notice: Undefined variable: username in /home/zonk/public_html/test.php on line 11 Notice: Undefined index: username in /home/zonk/public_html/test.php on line 12 Notice: Undefined index: username in /home/zonk/public_html/test.php on line 13 Notice: Undefined index: username in /home/zonk/public_html/test.php on line 14 username=zonk&email=zonk&submit=Submit+me%21 You see. It looks like the intrepreter hates me, doesn't it? :-) > Hopefully one of this will output something relevant. Otherwise, I suppose > it's possible that there is a bug in the CGI SAPI, unless I'm missing > something. Or we both. But it looks more like a bug to me because it should work with no preceding actions taken. > Hope that helps. Oh thanks a lot. And apologies for wrong background info:) Take care. Arne Rusek -- Arne Rusek <zonk@matfyz.cz>

« previous php.general (#169813) next »