Enterprise code development php version 2-text messages return text messages sent by users, modify sample. php
DecryptMsg ($ sReqMsgSig, $ sReqTimeStamp, $ sReqNonce, $ sReqData, $ sMsg); if ($ errCode = 0) {$ postStr = $ sMsg; // The following is a normal operation: $ postObj = simplexml_load_string ($ postStr, 'simplexmlelement', LIBXML_NOCDATA); $ fromUsername = $ postObj-> FromUserName; $ toUsername = $ postObj-> ToUserName; $ content = trim ($ postObj-> Content); $ time = time (); $ textTpl ="
%s
%s
% S
text
%s
"; $ SRespData = sprintf ($ textTpl, $ fromUsername, $ toUsername, $ time, $ content); // encrypted output $ sEncryptMsg = ""; // ciphertext in xml format $ errCode = $ wxcpt-> EncryptMsg ($ sRespData, $ sReqTimeStamp, $ sReqNonce, $ sEncryptMsg); if ($ errCode = 0) {echo $ sEncryptMsg;} else {print ("ERR :". $ errCode. "\ n"); // exit (-1) ;}} else {print ("ERR :". $ errCode. "\ n"); // exit (-1) ;}?>