How to get HTTP request as an array?
Posted: Thu Jun 19, 2003 6:34 am
How to get HTTP request as an array of parametes=>values?
Thanx.
Bernie.
Thanx.
Bernie.
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
[]InTeR[] wrote:Request variables: $_REQUEST
Note: Introduced in 4.1.0. There is no equivalent array in earlier versions.
An associative array consisting of the contents of $_GET, $_POST, and $_COOKIE.
Note: Prior to PHP 4.3.0, $_FILES information was also included into $_REQUEST.
This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. You don't need to do a global $_REQUEST; to access it within functions or methods.
If the register_globals directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the $_REQUEST array. For related information, see the security chapter titled Using Register Globals. These individual globals are not autoglobals
Code: Select all
foreach ($_REQUEST as $key => $value) {
echo '$key='.$key.' and value='.$value;
}twigletmac wrote:Could you explain a bit more what you are trying to achieve. Are you looking to use something like foreach()?MacCode: Select all
foreach ($_REQUEST as $key => $value) { echo '$key='.$key.' and value='.$value; }