DPT在返回程序中遇到问题

时间:2013-07-10 00:26:06

标签: php paypal-sandbox eclipse-pdt

犯了一个newbe错误让我再试一次。

该网站是非营利性的,几年前我添加了一个PayPal“捐赠”页面;作为购物车完成(3种捐赠和/或会员资格)。 PP返回到php脚本,该脚本使用PDT数据构建感谢页面并为双重选择邮件列表设置cookie。 IPN发送感谢邮件,选择加入电子邮件,数据库等工作正常。

现在为故障单预订页面添加PayPal选项。再次,一个叫PayPal的购物车,似乎在沙盒中工作正常; PayPal屏幕符合预期,两个foo电子邮件看起来正确。我传递了一个不同的返回URL,这个URL被调用,但手上的炸弹却被震动了。代码将从之前的工作中删除并基于PayPal PDT示例。

    // read the post from PayPal system and add 'cmd'
    $req = 'cmd=_notify-synch';
    $header = "";

    $tx_token = $_GET['tx'];

    $req .= "&tx=$tx_token&at=$auth_token";  // see header for def of auth_token
    // post back to PayPal system to validate
    $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
    $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
    $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
    // If possible, securely post back to paypal using HTTPS
    // Your PHP server will need to be SSL enabled

    $fp = fsockopen ($socket, $port, $errno, $errstr, 30); // see header

    if (!$fp) 
    {
       // HTTP ERROR
       mail($email, "PDT Error", "fsockopen error " . $errno . ":   " . $errstr);
    } 
    else 
    {

   fputs ($fp, $header . $req);
   // read the body data
   $res = '';
   $headerdone = false;
   while (!feof($fp)) 
   {
      $line = fgets ($fp, 1024);
    echo $line . "<br>";
      if (strcmp($line, "\r\n") == 0) 
      {
         // read the header
         $headerdone = true;
      }
      else if ($headerdone)
      {
         // header has been read. now read the contents
         $res .= $line;
      }
   }

增加的回声的结果是:

找到HTTP / 1.0 302

地点:https://www.sandbox.paypal.com

服务器:BigIP

连接:关闭

内容长度:0

var $ auth_token,$ socket和$ port设置为“if($ test)”以在沙箱和live之间切换。显然有0长度有效载荷,没有其他工作。

我在这里读到了关于新Auth_token的内容。关于测试SUCCESS还有一些其他的问题,我没有得到,没有数据可以使用..

我不记得了,沙盒会触发IPN吗?我也没有得到任何东西 - 为沙盒设置。感谢有关在哪里寻找的任何建议。

0 个答案:

没有答案