paypal 샌드 박스 ipn 시뮬레이터 도구를 사용할 때 ipn.php 파일을 어떻게 디버깅합니까?paypal 샌드 박스 ipn 시뮬레이터를 사용할 때 ipn.php 디버깅
코드는 다음과 같습니다
// read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-validate';
foreach($_POST as $key = > $value) {
$value = urlencode(stripslashes($value));
$req. = "&$key=$value";
}
// post back to PayPal system to validate
$header = "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header. = "Content-Type: application/x-www-form-urlencoded\r\n";
$header. = "Content-Length: ".strlen($req)."\r\n\r\n";
$fp = fsockopen('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
if (!$fp) {
// HTTP ERROR
} else {
fputs($fp, $header.$req);
while (!feof($fp)) {
$res = fgets($fp, 1024);
if (strcmp($res, "VERIFIED") == 0) {
$DBH = new PDO("mysql:host=localhost;dbname=db", "user", "pass");
$DBH - > setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$STH = $DBH - > prepare("update table2 set status = :status where tracking_id = :tracking_id");
$status = 1;
parse_str($req, $data);
$STH - > bindParam(':status', $status, PDO::PARAM_INT, 1);
$STH - > bindParam(':tracking_id', 'id_goes_here', PDO::PARAM_STR, 50);
$STH - > execute();
$DBH = null;
} else if (strcmp($res, "INVALID") == 0) {
// do something else
}
}
fclose($fp);
}
내가 일반적으로 디버깅 넷빈즈 디버그 기능을 사용하지만, 어떻게 샌드 박스 시뮬레이터를 사용하여 디버깅 할 수 있습니까? 내가 샌드 박스 ipn 시뮬레이터에서 send ipn
을 클릭하면 모래 상자에 IPN successfully sent.
을 말하는 메시지가 나타납니다. 그런 다음 데이터베이스에 들어가서 status
을 확인하면 여전히 0
입니다. 테이블 '표 2'가 실패합니다 TRACKING_ID = 'id_goes_here'업데이트 작업으로 행을 포함하지 않는 경우
공식 코드 샘플을 확인 https://www.x.com/developers/paypal/documentation-tools/paypal-code-samples – DTukans