【发布时间】:2015-01-06 17:07:14
【问题描述】:
我正在使用以下代码
$header = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer ' . $accessToken );
$url = 'https://api.sandbox.paypal.com/v1/payments/payment/' . $data['PaymentId'];
//cURL starts
$crl = curl_init();
curl_setopt($crl, CURLOPT_URL, $url);
curl_setopt($crl, CURLOPT_HTTPHEADER,$header);
curl_setopt($crl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($crl, CURLOPT_HTTPGET,true);
$reply = curl_exec($crl);
//error handling for cURL
if ($reply === false) {
print_r('Curl error: ' . curl_error($crl));
}
curl_close($crl);
//cURL ends
//decoding the json data
$decoded_data = json_decode($reply, true);
虽然标题等看起来不错,但响应为空。我需要 curl 到 PayPal 以检查应用上的付款是否成功。
【问题讨论】: