P
P
PandaTheSlayer2017-08-20 23:00:52
PHP
PandaTheSlayer, 2017-08-20 23:00:52

Why doesn't the PayPal curl request work?

In general, such a disaster: everything works fine on the PayPal test server, but there is a problem on the real server.

$data = array(
        'cmd' => '_notify-synch',
        'tx' => $pdt_tx,
        'at' => $PDT_TOKEN
    );
    $opts = array(
        CURLOPT_URL => 'https://www.paypal.com/cgi-bin/webscr',
        CURLOPT_HEADER => 0,
        CURLOPT_NOBODY => 0,
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_POST => 1,
        CURLOPT_FOLLOWLOCATION => 1,
        CURLOPT_SSL_VERIFYPEER => 1,
        CURLOPT_POSTFIELDS => http_build_query($data),
        CURLOPT_VERBOSE => true
    );

    $curlHandler = curl_init();
    curl_setopt_array( $curlHandler, $opts );
    $output = curl_exec($curlHandler);
    curl_close($curlHandler);

This code is not executed, it just goes into eternal loading (cannot connect to the server). Moreover, as I said, everything goes great to the sandbox.paypal.com URL

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
PandaTheSlayer, 2017-08-26
@PandaTheSlayer

Problem solved. For anyone who might be looking for a solution
, paypal has a battle url like this:
paypal.com/webscr

D
Dimonchik, 2017-08-20
@dimonchik2013

see that verbose outputs
CURLOPT_SSL_VERIFYPEER to zero set

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question