我正在使用一个支付网关,该网关在完成付款后会通过URL发送JSON文件到我的网站,特别是一个PHP文件。我已将PHP文件编码如下:
$json = file_get_contents('php://input');
$obj = json_decode($json, TRUE);
if ($obj) {
$to = 'test@test.co.uk';
$subject = "It exists";
$message .= $smart_id. "\r\n\r\n";
$message .= $bbct_id. "\r\n\r\n";
mail( $to, $subject, $message);
} else {
$to = 'test@test.co.uk';
$subject = "Nothing here";
$message .= $smart_id. "\r\n\r\n";
$message .= $bbct_id. "\r\n\r\n";
mail( $to, $subject, $message);
}