S
S
SirexElite2019-12-10 14:08:54
PHP
SirexElite, 2019-12-10 14:08:54

Simulate how a php form works?

Hello. I want to connect paypal payment, but I don't like that the data is stored there in hidden inputs. I decided to try to make a post request through the server (without the participation of the client), but there were problems: I can not redirect to the request page.
This is how I send a post from the server, but how do I go along with it to the request page?

$params = [
                'cmd' => '_xclick',
                'business' => '[email protected]',
                'item_name' => 'Пополнение баланса',
                'item_number' => $_SESSION['User']['Login'],
                'currency_code' => 'RUB',
                'amount' => $_POST['amount'],
                'cancel_return' => '#######/payments/cancel_return',
                'return' => '#######/profile/' . $_SESSION['User']['Login'],
                'notify_url' => '#######/payments/ipn'
            ];

            $myCurl = curl_init();
            curl_setopt_array($myCurl, array(
                CURLOPT_URL => 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr',
                //Для реальных людей
                //CURLOPT_URL => 'https://www.paypal.com/cgi-bin/webscr',
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_POST => true,
                CURLOPT_POSTFIELDS => http_build_query($params)
            ));
            $response = curl_exec($myCurl);
            curl_close($myCurl);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2019-12-10
@FanatPHP

No way

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question