我的代码中的错误是什么?我想要使​​用获取客户信息

时间:2016-03-02 06:51:54

标签: php ios curl paypal-sandbox

配置文件共享服务器端集成(PayPal-iOS-SDK)

使用有效的访问令牌检索客户信息。但它不起作用(客户信息无法获取我的代码中的问题。如果有任何想法和代码请帮助我)

$access_token = "xxxx";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.sandbox.paypal.com/v1/identity/openidconnect/userinfo/?schema=openid");
curl_setopt($ch, CURLOPT_HEADER, "Content-Type:application/json");
curl_setopt($ch, CURLOPT_HEADER, "Authorization: Bearer ".$access_token);

$result1 = curl_exec($ch);

curl_close($ch);
print_r($result1);die;

1 个答案:

答案 0 :(得分:0)

$access_token = "xxxxx";


$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://api.sandbox.paypal.com/v1/identity/openidconnect/userinfo?schema=openid&access_token=xxxx");
$headers = array("Accept: application/json", "Accept-Language: en_US");
curl_setopt($ch, CURLOPT_HEADER, $headers);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HEADER, "Authorization: Bearer ".str_replace(" ", "", $access_token));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);



$result1 = curl_exec($ch);
$information = curl_getinfo($ch);
curl_close($ch);
print_r($information);die;

https://gist.github.com/xcommerce-gists/4007896#file-getuserprofile-request-curl