如何检测支付宝接口中notify_url.php有没有返回,支付宝中的手机网站支付接口,php版 notify_url.php 异步通知页面未成功执行...
require_once("alipay.config.php");
require_once("lib/alipay_notify.class.php");
$alipayNotify = new AlipayNotify($alipay_config);
$verify_result = $alipayNotify->verifyNotify();
if($verify_result) {//驗(yàn)證成功
$notify_data = $alipayNotify->decrypt($_POST[‘notify_data‘]);
$doc = new DOMDocument();
$doc->loadXML($notify_data);
if( ! empty($doc->getElementsByTagName( "notify" )->item(0)->nodeValue) ) {
$out_trade_no = $doc->getElementsByTagName( "out_trade_no" )->item(0)->nodeValue;
$trade_no = $doc->getElementsByTagName( "trade_no" )->item(0)->nodeValue;
$trade_status = $doc->getElementsByTagName( "trade_status" )->item(0)->nodeValue;
if($_POST[‘trade_status‘] == ‘TRADE_FINISHED‘ || $_POST[‘trade_status‘] == ‘TRADE_SUCCESS‘) {
//以下是數(shù)據(jù)庫操作代碼
require_once(‘../Connections/coon.php‘);
mysql_select_db($database_coon, $coon);
mysql_query("UPDATE shop_orders SET ZT=‘payed‘ WHERE DDH=‘$out_trade_no‘");
mysql_close($coon);
//數(shù)據(jù)庫操作結(jié)束
echo "success";
}
}
}
else {
echo "fail";
}
?>
操作數(shù)據(jù)庫的代碼沒有執(zhí)行,查過支付寶可以正常訪問這個頁面。問題出現(xiàn)在解密或者解析XML上,請問高手們這個哪里有問題?我是采用RSA加密方式。
你這是官方文檔應(yīng)用的 這個文檔是有錯誤的!!低級錯誤!!!$_POST[‘trade_status‘]改成$trade_status寫日志調(diào)試!!!
追問:
非常感謝您!改了之后就成功了!感謝無私的奉獻(xiàn)!
追答:
官方給的實(shí)例問題!!!不客氣!!
原文:http://www.cnblogs.com/phpxuetang/p/4857154.html
總結(jié)
以上是生活随笔為你收集整理的如何检测支付宝接口中notify_url.php有没有返回,支付宝中的手机网站支付接口,php版 notify_url.php 异步通知页面未成功执行...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 汉字编码计算机,计算机汉字编码,comp
- 下一篇: LDAP入门