PayPal IPN に関して私が抱えている苛立たしい問題について、誰かが私を助けてくれるかどうか疑問に思っています。私のコードは次のとおりです。
<?php
error_reporting(E_ALL);
// tell PHP to log errors to ipn_errors.log in this directory
ini_set('log_errors', true);
ini_set('error_log', dirname(__FILE__).'/ipn_errors.log');
// intantiate the IPN listener
include('ipnlistener.php');
$listener = new IpnListener();
// tell the IPN listener to use the PayPal test sandbox
$listener->use_sandbox = false;
// try to process the IPN POST
try {
$listener->requirePostMethod();
$verified = $listener->processIpn();
} catch (Exception $e) {
error_log($e->getMessage());
exit(0);
}
// TODO: Handle IPN Response here
// ...
if ($verified) {
echo 'hello';
// TODO: Implement additional fraud checks and MySQL storage
mail('my email here', 'Valid IPN', $listener->getTextReport());
} else {
// manually investigate the invalid IPN
mail('my email here', 'Invalid IPN', $listener->getTextReport());
}
?>
私のipnlistener.phpはここにあるものです: https://github.com/Quixotix/PHP-PayPal-IPN
誰かが支払いを送信すると、コードで必要なように有効な IPN 電子メールを受け取りますが、他に何もエコーされず (つまり、hello がエコーされず)、ページのフッターが表示されません。何かをエコーすることを拒否するようなものですが、残りのコマンドに従います。エラー ログには、常に「無効な HTTP 要求メソッド」が表示されます。
誰でも助けることができますか?
ありがとう。
編集:知っておくと役立つ場合に備えて、以前にエコーされたものはすべて
try {
$listener->requirePostMethod();
$verified = $listener->processIpn();
} catch (Exception $e) {
error_log($e->getMessage());
exit(0);
}
は問題ありませんが、後でエコーされたものは機能しません。