Welcome Guest, Not a member yet? Register   Sign In
Paypal background post page thingy
#1

[eluser]johnwbaxter[/eluser]
I'm using the wiki paypal lib for the payment bit of my site.

At the point where you click the checkout button, i want to post some hidden variables to another page, which will then add some more variables to post, and forward the user onto paypal.

I want this "posting" page to run in the background as it needs to post some data that i don't want the user to be able to see by viewing the source of the page.

Can anyone give me some pointers as to how to achieve this please!?

I'm really not sure how to tackle this and don't know if i need to generate some headers in the controller which will make the page go off to paypal or what really.

I hope I've explained myself well enough.

Thanks in advance for any assistance!
#2

[eluser]frenzal[/eluser]
this is the code I used to post my GET vars to a page:

Code:
function post_data($vars,$url){
        $ch = curl_init();
        curl_setopt($ch,CURLOPT_URL,$url);
        curl_setopt($ch,CURLOPT_POST,1);
        curl_setopt($ch,CURLOPT_POSTFIELDS,$vars);
        curl_exec($ch);
        curl_close($ch);
}


$data = $_SERVER['QUERY_STRING'] . "&referer;=". $_SERVER['REMOTE_ADDR'];

if($data){
    $action = "http://www.site.com/postprocess";
    post_data($data, $action);
}
#3

[eluser]johnwbaxter[/eluser]
Nice! I'll give it a go, thank you very much!
#4

[eluser]johnwbaxter[/eluser]
I've been trying everything with this to try and get it to work but i'm having no luck!

The type of paypal i'm dong is where they click checkout and then they go to paypal to make the payment. I'm not taking the payment on my site if that makes any difference.

I've taken the code you provided and made a new function in my controller that gets the data and then does

$this->post_data($data, $action);

I've pointed my form to this function expecting it to take my browser off to paypal but it err doesn't.

Any tips you can give me? Am i doing this all wrong?

Cheers!




Theme © iAndrew 2016 - Forum software by © MyBB