SagePay通知空白


SagePay Notification Blank

我有一个问题,我希望有人能帮我解决,因为SagePay的支持就像巧克力茶壶一样有用。我有一个带有SagePay服务器集成的定制电子商务解决方案,有些运行v2.23,有些运行v3.00。我们有几个网站突然停止工作。

SagePay的通知是空白的,完全是空的。这两个网站都没有可用的帖子数据。然而,我们还有另外两个网站,没有其他问题,一切都很好。

这4个网站之间唯一的区别是版本,这需要对发送到SagePay的内容和托管位置进行一些小的更改。这两个工作网站由HeartInternet托管,而两个不工作的网站由不同的主机托管,一个使用123reg,另一个使用未知的美国主机。

SagePay已经向我发送了他们的几笔交易日志,都显示了通知数据,所以就他们而言,他们发送给我的很好,这是服务器问题。我甚至不知道从哪里开始调试它。

不确定它是否相关,但我在通知方法的开头添加了:

public function Notify() {
    $this->Load();
    define('LOG_FILE', ROOT_LIB . 'sagepaylog-v2.23.txt');
    error_log(date('c') . " NEW NOTIFICATION" . PHP_EOL, 3, LOG_FILE);
    $input = file_get_contents('php://input');
    $query = $response = array();
    $exp = explode('&', $input);
    foreach($exp as $keyVal) {
        $e = explode('=', $keyVal, 2);
        $response[$e[0]] = urldecode($e[1]);
    }
    /* Comment out the above code and uncomment below when testing using POSTMAN.
    foreach($_POST as $key => $val) {
        $response[$key] = $val;
    }*/
    error_log("Notification Post Data" . PHP_EOL . "-------------------------" . PHP_EOL, 3, LOG_FILE);
    foreach($response as $key => $val) {
        error_log("$key: $val" . PHP_EOL, 3, LOG_FILE);
    }
    //We record the transaction during the initial registration. We need to load the details of that transaction, and of the order for the specified order ID, and make sure they match the details sent to us by SagePay.
    $valid = FALSE;
    $orders = $this->glob->order->LoadOrderHistory("WHERE ordId = " . (int)$response['VendorTxCode'], TRUE);
    if(count($orders)) {
        $order = $orders[$response['VendorTxCode']];
    } else {
        $order = new Order($this->glob);
    }
    $transaction = new Transaction($this->glob, $order->txnId);

原来这是由htaccess将非www重定向到www引起的,并且通知URL不包括www。这是通过检查URL并在前面添加www(如果还没有)来修复的。