doushe7934 2018-06-08 11:25
浏览 134

PayPal Rest API PHP cURL登录/身份验证不再有效

We set up a PayPal express checkout about 2 weeks ago which worked perfectly until a couple of days ago it didn't. On PayPal the transactions is ok but when I try to log in with cURL to check the transaction the inital merchant/client login fails but cURL shows no error. I know that PayPal is upgrading to TLS 1.2 and HTTP/1.1 but I did the test check were our server/site passed.

This is how I initated the communication with paypal (this worked until now):

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://paypal.com/v1/oauth2/token');
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_USERPWD, 'CLIENT_ID:SECRET');
curl_setopt($ch, CURLOPT_POSTFIELDS, 'grant_type=client_credentials');
$result = curl_exec($ch);

Now if I print out $result its empty, if I print out curl_errno its 0 and curl_error also empty

so because of TLS 1.2 I modified the code like this

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://paypal.com/v1/oauth2/token');
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSLVERSION, 6);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_USERPWD, 'CLIENT_ID:SECRET');
curl_setopt($ch, CURLOPT_POSTFIELDS, 'grant_type=client_credentials');
$result = curl_exec($ch);

but it fails exactly the same as the previous code.

What could be the problem? or is it possible that if the login is ok the result is empty?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 交替优化波束形成和ris反射角使保密速率最大化
    • ¥15 树莓派与pix飞控通信
    • ¥15 自动转发微信群信息到另外一个微信群
    • ¥15 outlook无法配置成功
    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程