首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ipn侦听器paypal

问ipn侦听器paypal
EN

Stack Overflow用户
提问于 2013-02-21 15:54:51
回答 1查看 1.2K关注 0票数 0

我在做简单的购物车,一个问题是让我疯狂的IPN听者无法工作。

当我付款时,我会被重定向回“谢谢”页面,这些值将被打印出来。

thankyou.php下面的那些帖子打印出来了,也有很多帖子变量。

代码语言:javascript
复制
[address_status] => confirmed

[payment_status] => Completed

[payer_status] => verified

问题是我的IPN侦听器不起作用。

代码语言:javascript
复制
<input type="hidden" name="notify_url" value="http://mysqlphp.uphero.com/paypal_ipn.php">

,这是我的paypal_ipn.php的脚本,下面是:

代码语言:javascript
复制
// 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";
    }

    $url = "https://www.sandbox.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); 

// Check that the result verifies and sending email before doing anything i just wanted to make sure that this script is working but i don't receive an email

    if (strpos($curl_result, "VERIFIED") !== false) {
        $req .= "\n\nPaypal Verified OK";
        mail("eagleeyes26@hotmail.com", "IPN interaction verified", "$req", "eagleeyes26@hotmail.com" );


}
EN

回答 1

Stack Overflow用户

发布于 2013-08-18 11:20:34

我找到了这个解决方案

http://microlabs.altervista.org/paypal-ipn-listener/

和工作良好,功能自动化电子邮件附带下载购买,网站用意大利语,但你可以用页脚翻译。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15006606

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档