Re: Is it possible to send POST vars through a header redirect?
| From: | VamVan | Date: | Tue, 03 Feb 2009 22:59:31 +0000 |
| Subject: | Re: Is it possible to send POST vars through a header redirect? | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-287589@lists.php.net to get a copy of this message | ||
On Tue, Feb 3, 2009 at 2:54 PM, Jim Lucas <lists@cmsws.com> wrote:
> TS wrote:
> > I'm trying to send vars via POST somehow. Is this possible?
> >
> > Currently I'm doing
> >
> > header("Location:
> > http://domain/index.php?var=3");
> >
> > but, want to send POST or some other method that doesn't stick with the
> session.
> >
> > Thanks, T
> >
> >
>
> No, it is not possible. You will need to look into cURL or something else.
>
> But it cannot be done via the header() function.
>
I second that you need to use curl:
$header = array(
"MIME-Version"=>"1.0",
"Content-type"=>"text/html; charset=utf-8"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->elqPosturl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, $this->curlOptTimeOut);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_PROXY, $this->proxyServer);
curl_setopt($ch, CURLOPT_PROXYPORT, $this->proxyPort);
curl_setopt($ch, CURLOPT_POSTFIELDS, $inputArray);
curl_setopt($ch, CURLOPT_USERAGENT, 'MSIE');
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_HEADER, 1);
$data = curl_exec($ch);
Thanks,
V