ここで提供される情報が不十分です...!
- 適切なnotify_urlがpaypalに送信されたことを確認してください
- CSRFが有効になっている場合、Codeigniterはアクションを許可しません!
- $ this-> input-> post()ではなく$_POST配列を確認する必要があります
Config.php
$config['uri_protocol'] = 'REQUEST_URI';
/*
|--------------------------------------------------------------------------
| Check to see if the request uri contains paypal
|--------------------------------------------------------------------------
*/
if( stripos($_SERVER["REQUEST_URI"],'/paypal') )
{
$config['csrf_protection'] = FALSE;
}
-Routes.php _
$route['paypal/notify'] = 'paypal/recieve_notification'; // www.mysite.com/paypal/notify
-Controllers
/ Paypal.php
class Paypal extends CI_Controller{
public function __construct(){ parent::__construct(); }
public function recieve_notification() //simplified function
{
try(
if( !$_POST )
throw new Exception('No POST data recieved from Paypal');
if( $_POST['verified'] !== 'VERIFIED') //im guessing here
throw new Exception('User not verified by paypal');
)catch(Exception $e){
//debugging: show_error($e->getMessage());
log_message('error', $e->getMessage());
redirect('/');
exit;
}
//Save to DB
$this->saveintodb( $_POST ); //expecting Exception thrown from DB ?
$this->session->flashdata('success', 'Data Saved!');
redirect('/');
}
}