0

这是我的 ipn 列表器代码,但是当我打开测试文件时它显示无效。我刚刚开始学习这个,它与教程的代码相同。在视频中它响应已验证。但在我的无效。

你能帮我么?

<?php

if($_SERVER['REQUEST_METHOD'] != 'POST'){
    header('index.php');
    exit() ;
}

$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr');
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,"cmd=_notify-validate&".http_build_query($_POST) );
$response = curl_exec($ch);
curl_close($ch);

file_put_contents("test.txt", $response);



?>
4

1 回答 1

0

我不确定每种情况都是如此,但我使用的示例代码设置了 VERIFYHOST, 1 AND VERIFYPEER, 2

你可以试试看会发生什么。

于 2019-06-06T23:05:51.227 回答