Re: $_POST issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1 December 2010 14:50, Bundhoo M Nadim <nadim@xxxxxxxxxxxxxxxx> wrote:
> Hello,
>
> Can someone explain me what this piece of code basically does ?
>
> <?php
> Â Âheader("Expires: " . gmdate("D, d M Y H:i:s", time() + (0*60)) . "GMT");
> Â Âheader("Pragma: no-cache");
> Â Âprint "REDIRECT=http://www.domaine.com/page.php?";;
> Â Â$param = http_build_query($_POST);
> Â Âprint $param;
> Â Âexit(0);
> ?>
>
> Well, the code is redirecting to some page with query string constructed
> using the $_POST data.
>
> My problem is not the redirection; but all I want is to get the data in
> $_POST
>
> If I just put only this piece of code:
>
> <?php
> Â Âvar_dump($_POST);
> ?>
>
> i get nothing. But the above codes is successfully redirecting me to
> page.php with a properly constructed query string -> which means that $_POST
> was never empty. So why var_dump($_POST) is returning just array(0) { } ???
>
> nadim attari
> alienworkers.com
>

Under normal circumstances, $_POST will only be populated from a
<form> with a method="post".

So, loading a URL to a PHP script containing just the var_dump() will
never output anything for $_POST as the URL wasn't the result of a
POST'd form.

You can also use cURL or stream_contexts to construct the data for
POST-ing and your script would receive these correctly.




-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux