예제 #1
0
   ---------------------------------------------------------------------------------------*/
chdir('../../');
include 'includes/application_top.php';
// include needed functions
require_once DIR_FS_INC . 'get_external_content.inc.php';
// include needed classes
require_once DIR_FS_EXTERNAL . 'paypal/classes/PayPalPayment.php';
// get request
$request_input = get_external_content('php://input', 3, false);
// get params
parse_str($request_input, $request);
$request['cmd'] = '_notify-validate';
// set payment
$paypal = new PayPalPayment('paypal');
// get transaction
$transaction = $paypal->get_transaction($request['txn_id']);
// set endpoint
$paypal_url = "https://www.paypal.com/cgi-bin/webscr";
if ($paypal->get_config('PAYPAL_MODE') == 'sandbox') {
    $paypal_url = "https://www.sandbox.paypal.com/cgi-bin/webscr";
}
// validate
$ch = curl_init($paypal_url);
if ($ch === false) {
    header("HTTP/1.0 404 Not Found");
    header("Status: 404 Not Found");
    exit;
}
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);