05-09-2012, 07:55 PM
[eluser]tagawa[/eluser]
Hi. I really like Micah's revised Paypal IPN library here:
https://github.com/Quixotix/PHP-PayPal-IPN
and am trying to convert it to a CI class. I can get the original library to work, but when I try out my controller with the Paypal sandbox test tool I get "IPN delivery failed. HTTP error code 500: Internal Server Error". Going to the controller's URL directly gets the same server error (which it should), so it doesn't seem to be a syntax bug.
I'm not a CI expert (yet) so it could be something simple I've overlooked. Can anyone see anything wrong with what I've done? Thanks in advance for any help.
Hi. I really like Micah's revised Paypal IPN library here:
https://github.com/Quixotix/PHP-PayPal-IPN
and am trying to convert it to a CI class. I can get the original library to work, but when I try out my controller with the Paypal sandbox test tool I get "IPN delivery failed. HTTP error code 500: Internal Server Error". Going to the controller's URL directly gets the same server error (which it should), so it doesn't seem to be a syntax bug.
I'm not a CI expert (yet) so it could be something simple I've overlooked. Can anyone see anything wrong with what I've done? Thanks in advance for any help.
Code:
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Paypal extends CI_Controller {
function __construct() {
parent::__construct();
}
function index() {
$listener = new IpnListener();
$listener->use_sandbox = true;
try {
$listener->requirePostMethod();
$verified = $listener->processIpn();
} catch (Exception $e) {
mail('MY_EMAIL_ADDRESS', 'IPN error', $e->getMessage());
exit(0);
}
if ($verified) {
mail('MY_EMAIL_ADDRESS', 'Verified IPN', $listener->getTextReport());
} else {
mail('MY_EMAIL_ADDRESS', 'Invalid IPN', $listener->getTextReport());
}
}
}
class IpnListener {
// Existing class untouched
}
?>