ipn/listener.php
<?php include 'ipn_handler.class.php';
/**
* Logs IPN messages to a file.
*/
class Logging_Ipn_Handler extends IPN_Handler
{
public function process(array $post_data)
{
$data = parent::process($post_data);
if($data === FALSE)
{
header('HTTP/1.0 400 Bad Request', true, 400);
exit;
}
$output = implode("\t", array(time(), json_encode($data)));
file_put_contents('log.txt', $output.PHP_EOL, FILE_APPEND);
}
}
date_default_timezone_set('Europe/Oslo');
$handler = new Logging_Ipn_Handler();
$handler->process($_POST);