0

IPN 配信に失敗しました。指定された URL に接続できません。URL を確認して、もう一度お試しください。

Paypal IPN シミュレーターを使用しようとしていますが、このエラー メッセージが表示されるたびに、指定された URL が正しいと確信しているにもかかわらず、ipn シミュレーターが指定された 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スクリプトを試したときに、ファイルを他のWebサーバーに転送しました.驚いたことに、ipnシミュレーターは正常にipnをipnハンドラーページに送信します

于 2013-02-22T09:07:42.727 に答える