0

IPN 传送失败。无法连接到指定的 URL。请验证 URL,然后重试。

我正在尝试使用我的 Paypal ipn 模拟器,但每次它给我这个错误消息时,似乎 ipn 模拟器无法访问指定的 URL,即使我确定指定的 URL 是正确的。请有任何帮助

// Connect to database --------------------------------------------------------------------------------------------------

----
    require_once ('../config/cart_api.php');

    // bussines email
    $bussines_email = 'tbuss_1358873839_biz@hotmail.com';


// Check to see there are posted variables coming into the script
if ($_SERVER['REQUEST_METHOD'] != "POST") die ("No Post Variables");

// Initialize the $req variable and add CMD key value pair
$req = 'cmd=_notify-validate';
// Read the post from PayPal
foreach ($_POST as $key => $value) {
    $value = urlencode(stripslashes($value));
    $req .= "&$key=$value";
}

// Now Post all of that back to PayPal's server using curl, and validate everything with PayPal
// We will use CURL instead of PHP for this for a more universally operable script (fsockopen has issues on some environments)
$url = "https://www.sandbox.paypal.com/cgi-bin/webscr";
//$url = "https://www.paypal.com/cgi-bin/webscr";
$curl_result=$curl_err='';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/x-www-form-urlencoded", "Content-Length: " . strlen($req)));
curl_setopt($ch, CURLOPT_HEADER , 0);   
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$curl_result = @curl_exec($ch);
$curl_err = curl_error($ch);
curl_close($ch);

$req = str_replace("&", "\n", $req);  // Make it a nice list in case we want to email it to ourselves for reporting

// Check that the result verifies
if (strpos($curl_result, "VERIFIED") !== false) {
    $req .= "\n\nPaypal Verified OK";
    mail("eagleeyes26@hotmail.com", "IPN interaction verified keep going", "$req", "eagleeyes26@hotmail.com" );

} else {
    $req .= "\n\nData NOT verified from Paypal!";
    mail("eagleeyes26@hotmail.com", "IPN interaction not verified", "$req", "eagleeyes26@hotmail.com" );
    exit();
}

/* CHECK THESE 4 THINGS BEFORE PROCESSING THE TRANSACTION, HANDLE THEM AS YOU WISH
1. Make sure that business email returned is your business email
2. Make sure that the transaction�s payment status is �completed�
3. Make sure there are no duplicate txn_id
4. Make sure the payment amount matches what you charge for items. (Defeat Price-Jacking) */

// Check Number 1 ------------------------------------------------------------------------------------------------------------
if ($bussines_email != $_POST['receiver_email']) 
{
    $message = "Investigate why and how receiver email is wrong. Email = " . $_POST['receiver_email'] . "\n\n\n$req";
    mail("eagleeyes26@hotmail.com", "Receiver Email is incorrect", $message, "From: eagleeyes26@hotmail.com" );
    exit(); // exit script
}

// Check number 2 ------------------------------------------------------------------------------------------------------------
if ($_POST['payment_status'] != "Completed") {
    // Handle how you think you should if a payment is not complete yet, a few scenarios can cause a transaction to be incomplete
}
else 
    {
        $message = "Payment status is completed = " . $_POST['payment_status'] . "\n\n\n$req";
        mail("eagleeyes26@hotmail.com", "Payment status is completed", $message, "From: eagleeyes26@hotmail.com" );
        exit(); // exit script
    }
4

2 回答 2

1

您是否已将文件上传到免费的 weberver 上?或免费域名?这发生在我身上,当我尝试存储在 000webhost 上的 ipn 脚本时,我将文件传输到其他网络服务器上,令我惊讶的是,ipn 模拟器成功地将 ipn 发送到我的 ipn 处理程序页面

于 2013-02-22T09:07:42.727 回答
0

Paypal IPN 模拟器对我不起作用。我使用了两台不同的服务器,登录到外部 linux 服务器(在另一个国家/地区)并且 wgetting 处理程序 url 工作正常。使用模拟器没有收到任何内容,模拟器页面在一段时间后打印“IPN 传递失败:I/O 错误:连接超时;嵌套异常是 java.net.ConnectException:连接超时”。

处理程序 url 是 tomcat jsp 页面,使用 ip 和主机名没有帮助。

https://developer.paypal.com/webapps/developer/applications/ipn_simulator
http://111.222.333.444:8080/testing/paypal_IPN.jsp
http://myserver.com:8080/testing/paypal_IPN.jsp

如果我自己在浏览器中调用 paypal_IPN.jsp,它会使用 cmd=_notify-validate& 参数调用https://www.sandbox.paypal.com/cgi-bin/webscr url,并且 jsp 会按照预期读取 INVALID 字符串回复,因为这是一个无论如何,foodoo 交易。

测试商户开启IPN,IPN历史显示交易,尝试重发交易,均失败。我的 Paypal 集成测试用例的大场面,如果不能验证结帐管道,就无法上线。

IPN 在商家测试应用程序中启用,但这不应该影响 IPN 模拟器。使用 POSTFORM 经典提交 cgibin 按钮正常,测试签证支付正常,但即使这样,IPN 处理程序 url 也没有被调用。IPN 历史记录显示失败状态的交易。

https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_profile-ipn-notify https://www.sandbox.paypal.com/cgi-bin/webscr

于 2013-05-18T17:18:21.683 回答