Re: Vars in URL
| From: | Shawn McKenzie | Date: | Thu, 06 Feb 2003 00:21:45 +0000 |
| Subject: | Re: Vars in URL | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-134520@lists.php.net to get a copy of this message | ||
O.K. I found this at php.net but it doesn't seem to bring up the paypal
page. I guess I am trying to simulate a form POST using headers. Any
ideas???
$paypal_vars is an array of the vars and values that paypal needs.
foreach($paypal_vars as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}
$req = substr($req, 1, strlen($req) - 1);
$header .= "POST www.paypal.com HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= 'Content-Length: ' . strlen($req) . "\r\n\r\n";
$fp = fsockopen (/xclick/, 80, $errno, $errstr, 30);
if(!$fp) {
echo "$errstr ($errno)";
} else {
fputs($fp, $header . $req);
while(!feof($fp)) {
$res = fgets ($fp, 1024);
}
fclose ($fp);
}
Thanks!
Shawn
"Chris Shiflett" <shiflett@php.net> wrote in message
news:20030205225332.73244.qmail@web14301.mail.yahoo.com...
> --- Shawn McKenzie <nospam@mckenzies.net> wrote:
> > I want to pass vars to another site but I don't want
> > to use a form. How can I pass these vars to another
> > site without the vars being shown in the URL.
>
> That question is far too vague in terms of who needs to be
> passing data where. If you want to pass data to a Web
> server, and you do not want to use URL variables, then your
> only options are POST and cookies.
>
> If you are speaking about a user of your Web site who needs
> to be sending data to a Web server, and you do not want
> them to use URL variables or submit an HTML form, then
> cookies are your only option.
>
> Perhaps you can elaborate on what you are trying to
> accomplish?
>
> Chris