2013-05-17 5 views
0

예 : $ item_number = $ _POST [ 'item_number']; Paypal 양식 필드의 변수에 할당하려는 모든 게시물에 대해 '정의되지 않은 색인'이 반환됩니다.Paypal IPN - 정의되지 않은 색인 오류

하드 코딩하면 $ item_number = 1; 그것은 작동합니다.

아래의 Micah Carrick 스크립트를 사용하고 있습니다. 왜 이런 일이 발생하는지 알고 싶습니다. 당신이 순서에 페이팔을 통해 항목 번호를 통과하면

<?php 
/* 
ipn.php - example code used for the tutorial: 

PayPal IPN with PHP 
How To Implement an Instant Payment Notification listener script in PHP 
http://www.micahcarrick.com/paypal-ipn-with-php.html 

(c) 2011 - Micah Carrick 
*/ 

// 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 = true; 

// try to process the IPN POST 
try { 
    $listener->requirePostMethod(); 
    $verified = $listener->processIpn(); 
} catch (Exception $e) { 
    error_log($e->getMessage()); 
    exit(0); 
} 

if ($verified) { 


$item_number = $_POST['item_number']; 
$to = "[email protected]"; 
$subject = "Paypal IPN Test"; 
$message = "Email sent successfully"; 
$message .= $item_number; 
mail($to,$subject,$message,$listener->getTextReport()); 


} 
else { 
// manually investigate the invalid IPN 
mail('[email protected]', 'Invalid IPN', $listener->getTextReport()); 
} 

?> 

답변

0

item_number에만 존재한다. 제품 ID 또는 SKU라고 생각하십시오.

제품의 식별자가 필요없는 경우 건너 뜁니다.

+0

정보 주셔서 감사합니다, 문제는 내가 페이팔 카트를 사용하고 변수가 $ item_number1 = $ _POST [ 'item_number1']; 이제 item_numbers를 반복하는 방법을 찾아야합니다. 데이터베이스에서 productID를 식별하려면이 값이 필요합니다. Paypal은 당신이 일할 수있는 변수에 관해서는 매우 가난합니다. 나는 'id'와 일치해야하고 새로운 수량을 전달하지만 paypal 수량이 아닌 ..... 이렇게하려면 다른 Paypal 양식 필드를 사용해야합니다. 나는 '사용자 정의'필드로 시도했지만 카트는 하나의 '사용자 정의'필드 만 허용합니다 ...... Paypal = 매우 가난합니다. – Osgood

관련 문제