不支持的操作数类型错误。 Paypal付款后返回时?

时间:2016-04-22 11:21:18

标签: php paypal payment-gateway

我收到错误 第27行/home4/moses/public_html/mywebsite.com/ipn-page-template.php中不支持的操作数类型。

我在ipn页面上的所有代码。

$url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';

// Set up request to PayPal
$request = curl_init();
curl_setopt_array($request, array
(
    CURLOPT_URL => $url,
    CURLOPT_POST => TRUE,
    CURLOPT_POSTFIELDS => http_build_query(array('cmd' => '_notify-validate') + $ipn_post_data),
    CURLOPT_RETURNTRANSFER => TRUE,
    CURLOPT_HEADER => FALSE,
    CURLOPT_SSL_VERIFYPEER => TRUE,
    CURLOPT_CAINFO => 'cacert.pem',
));

// Execute request and get response and status code
$response = curl_exec($request);
$status   = curl_getinfo($request, CURLINFO_HTTP_CODE);

// Close connection
curl_close($request);

if($status == 200 && $response == 'VERIFIED')
{
    $subject = "valid";
    $message = "good";
}
else
{
    $subject = "invalid";
    $message = "bad";
}

1 个答案:

答案 0 :(得分:0)

检查这两个的返回值 - 确保它们是字符串/整数/布尔值,而不是像数组或对象那样复杂的东西

var_dump($response);
var_dump($status);