Re: Relaying variables to distant site
| From: | Ernest E Vogelsinger | Date: | Fri, 15 Nov 2002 00:59:11 +0000 |
| Subject: | Re: Relaying variables to distant site | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-124547@lists.php.net to get a copy of this message | ||
At 00:41 15.11.2002, Mike MacDonald said:
--------------------[snip]--------------------
>Hi People!
>Can anyone help with this:
>
>
> Want to pick up variables passed from form in
> PHP page and pass to distant site. Can use
> long get, but would like to access ALL variables
> in the PHP page and pass them forward, without
> coding each individual one if possible
To construct the data to post to the distant server you'd simply loop
through the $_REQUEST array, like this:
$post = null;
foreach($_REQUEST as $var => $val) {
if ($post) $post .= '&';
$post .= htmlentities($var).'='.htmlentities($val);
}
You could use cUrl to POST data received from the form. Or, if you use a
query string, just transmit
http://wherever.distant:3000/receipient.php?$post.
Be aware that there's a
size limit for a query string.
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/