search

Home  >  Q&A  >  body text

php - WeChat Pay cannot receive the XML data of successful payment sent from the WeChat server?

Downloaded the official DEMO of WeChat Pay and paid using Mode 2. There is no problem with the payment now and the payment can be successful. However, the XML data sent by WeChat cannot be received in the callback notify.php;

The notify.php code is as follows:

$input = $GLOBALS['HTTP_RAW_POST_DATA'];
$xml = simplexml_load_string($input, 'SimpleXMLElement', LIBXML_NOCDATA);
var_dump($xml);

The WeChat official account payment authorization directory is as follows:

我想大声告诉你我想大声告诉你2750 days ago801

reply all(4)I'll reply

  • 世界只因有你

    世界只因有你2017-05-16 13:08:38

    If yesPHP7Use the following method to obtain the WeChat asynchronous notification parameters

    
    file_get_contents("php://input");
    
    

    reply
    0
  • PHPz

    PHPz2017-05-16 13:08:38

    $GLOBALS['HTTP_RAW_POST_DATA']; It seems that the entire function has been deleted in php7, use file_get_contents('php://input')

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-16 13:08:38

    1. First check the log in nginx or apache to check whether the WeChat client requested a callback connection after the payment was successful.
    2. If a link is requested, check the function logic issues in the callback

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-16 13:08:38

    Higher versions of PHP are not availableHTTP_RAW_POST_DATA
    Please use them consistently

    file_get_contents('php://input');

    reply
    0
  • Cancelreply