View Full Version : PHP help please... need a way to send POST variables

01-02-2007, 12:45 PM
I have a problem which i'm not sure how to solve -

I need to use a php redirect file to send variables to paypal using POST method, not GET.

The variables will be called from a config file... ie, config.php
which contains:

$price = '1'
$currency = '1'

Reason: I'm using this to hide paypal button code whilst still allowing these variables to be changed using other php code.

My idea was this (not code - just process):

1)include config.php
2)POST: price = $price etc
3)header( 'Location: paypal address **while sending post values**' )

can this be done?
If so, how?

Could a "fake form" be created by redirect.php instead of performing process 3
and have the php code "click" submit automatically?

If this doesn't make sense please let me know so that I can clarify...

Many thanks in advance,

01-02-2007, 02:01 PM
look at the examples at php.net for fsockopen (http://www.php.net/fsockopen) , or use a ready-made http client (google for snoopy)

01-03-2007, 02:43 PM
If you are creating a shopping cart or somthing like that to pass products to paypal then

all you need to do is something like this

<form action="paypal address" method="post" name="mainform">
<input type="hidden" name="price" id="price" value="<? print $price; ?>">

<script language="javascript">