Ò»¡¢½»Ò×֪ͨ
Óû§Ôڳɹ¦Íe³ÉÖ§¸¶ºo£¬Î¢Ðźǫ֪ͨ£¨POST£(C)ÉÌ»§*þÎñÆ÷£¨notify_url£(C)Ö§¸¶½a¹u¡£ÉÌ»§¿ÉÒÔʹÓÃnotify_urlµÄ֪ͨ½a¹u½øÐиoÐÔ»¯Ò³ÃaeµÄչʾ¡£
¶Ôºǫ֪ͨ½»»¥Ê±£¬Èç¹u΢ÐÅÊÕµ½ÉÌ»§µÄÓ¦´ð²»ÊÇsuccess»o³¬Ê±£¬Î¢ÐŲ»ÎªÍ¨ÖªÊ§°Ü£¬Î¢ÐÅ»aͨ¹ýÒ»¶¨µÄ²ßÂÔ£¨Èç30ÖÖÓ¹²8´Î£(C)¶¨ÆÚÖØТÆð֪ͨ£¬¾¡¿ÉÄÜÌa¸ß֪ͨµÄ³É¹¦ÂÊ£¬µ«Î¢ÐŲ»±£Ö¤Í¨Öª×iÖÕÄܳɹ¦¡£
ºǫ֪ͨͨ¹ýÇeÇoÖÐµÄ notify_url Þ‰ÐУ¬²ÉÓà POST »uÖÆ¡£
ͬʱ£¬ÔÚpostDataÖл¹½«°uº¬xmlÊý¾Ý¡£
¶þ¡¢½»Ò×½a¹u»ñÈ¡ÓeÏiÓ¦
¸u¾Ý¹Ù*½Îĵµ£¬´´½¨notice.phpÓÃÓÚ֪ͨ½a¹u¡£
³ÌÐoÄÚÈÝÈçÏÂËuʾ£º
<?php
foreach ($_GET as $key=>$value)
{
logger("Key: $key; Value: $value");
}
$postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
logger($postStr);
if (isset($_GET)){
echo "success";
}
//ÈÕÖ¾¼Ç¼
function logger($log_content)
{
$max_size = 100000;
$log_filename = "log.xml";
if(file_exists($log_filename) and (abs(filesize($log_filename)) > $max_size)){unlink($log_filename);}
file_put_contents($log_filename, date('H:i:s')." ".$log_content."\r\n", FILE_APPEND);
}
?>
ÉÏÊo³ÌÐoµÄ×÷ÓÃÊÇ£º
»ñÈ¡postµ½urlµÄ֪ͨ£¬ËuÃÇÒÔGET±aÁ¿ÐÎʽ
»ñÈ¡postµÄXMLÊý¾Ý°u
*µ»Ø³É¹¦ÏuÏ¢ success
½«notice.phpµÄÍeÕu¾¶ÅÈeJS APIÖ§¸¶µÄnotice urlÖС£
$wxPayHelper->setParameter("notify_url", http://www.doucube.com/wxpay/notice.php);
ÕaÑuµ±½»Ò×Íe³Éºo£¬¸Ãurl½«ÊÕµ½Í¨Öª£¬²¢¼Ç¼ÔÚÈÕÖ¾ÎļþÖУ¬ÎÒÃǵIJaÊÔÈçÏÂËuʾ£º
»ñµÃµÄGET±aÁ¿¼°XMLÈçÏÂËuʾ£º
Key: bank_billno; Value: 201405273540085997
Key: bank_type; Value: 2011
Key: discount; Value: 0
Key: fee_type; Value: 1
Key: input_charset; Value: GBK
Key: notify_id; Value: Gx8ov6tT6_yaARrtKG6RFZ4KiVtKqVnJzvulFlteJ3dhBg38iRtKs0pTXXfgh8WnH15mIhG6j65ggbzzYguh1mutG3B5oHsK
Key: out_trade_no; Value: JfuKdiBig4zZnE4n
Key: partner; Value: 1234567890
Key: product_fee; Value: 1
Key: sign; Value: 08876C4A9F7A36A9EA972C211C122362
Key: sign_type; Value: MD5
Key: time_end; Value: 20140527194139
Key: total_fee; Value: 1
Key: trade_mode; Value: 1
Key: trade_state; Value: 0
Key: transaction_id; Value: 1218614901201405273313473135
Key: transport_fee; Value: 0
<xml><OpenId><![CDATA[o0pk9uIVnlY-fJkzFKEbQ6LJ4cFc]]></OpenId>
<AppId><![CDATA[wx0000000000000000]]></AppId>
<IsSubscribe>1</IsSubscribe>
<TimeStamp>1401190899</TimeStamp>
<NonceStr><![CDATA[iOb2flJ0ILFAmBqJ]]></NonceStr>
<AppSignature><![CDATA[66678894aae680ba140e18e66d1295dfadabd9ab]]></AppSignature>
<SignMethod><![CDATA[sha1]]></SignMethod>
</xml>
¶øÔÚ΢ÐÅ´°¿ÚÖн«ÊÕµ½OKµÄµ¯³o´°
ÒÔÉϾÍÊǶÔ΢ÐÅÖ§¸¶¿ª*¢½»Ò×֪ͨµÄ×ÊÁÏÕuÀi£¬Ð»Ð»Ö§³Ö£¡