You are here: Re: [PHP] Apache 1.3x/PHP 5.0.3 404 error handler & posted data... « PHP « IT news, forums, messages
Re: [PHP] Apache 1.3x/PHP 5.0.3 404 error handler & posted data...

Posted by "Raymond C. Rodgers" on 07/10/05 22:44

On Sat, 2005-07-09 at 02:04 -0700, Rasmus Lerdorf wrote:
> Raymond C. Rodgers wrote:
> > I'm trying to write an error handler in PHP to try to avoid sending the
> > browser a 404 error message. Basically, if someone
> > requests /whatever.html on the server and it doesn't exist, my 404 error
> > handler checks to see if /whatever.php exists, if so, it then includes
> > that file.
> >
> > That part works fine.
> >
> > The part that I'm having trouble with is if /whatever.html happens to be
> > the target of a form POST. With GET requests, the data is available in
> > either $_SERVER['REDIRECT_QUERY_STRING'] or (worst case)
> > $_SERVER['REQUEST_URI']. That's easy enough to parse and turn into
> > $_REQUEST and/or $_GET. However, it seems that POSTed data just vanishes
> > into thin air. $_POST is not set, of course, and I've been trying to
> > read data using file_get_contents('php://input') but nothing is
> > returned... Is this a bug in PHP, Apache, not a bug but an unimplemented
> > feature, security precaution, or what? Am I missing something simple to
> > get the POSTed data?
>
> No, you can't do what you are trying to do the way you are trying to do
> it. Apache changes the original POST to a GET request on the internal
> errordocument redirect so PHP can't get at the original posted data.
> Well, it probably could with some hacking, but the web server has
> specifically told us that this is not a POST request anymore, so we
> respect that.

Thanks for the information. I would have thought the information would
still be available some where, some how, since $_SERVER provides a great
deal of information about the redirected request. (Such as the
REDIRECT_REQUEST_METHOD, REDIRECT_QUERY_STRING, etc. indexes.) Oh well,
live and learn. :-)

Raymond

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация