Recently developed the public number, learned something new, in this record, but also hope to help others
Public functionresponsemsg() {//$requestStr = $_request[' mpxml '); Off-line test release$requestStr=$GLOBALS["Http_raw_post_data"];//Online releaseif($requestStr=='')$requestStr= File_get_contents ("Php://input");//Online release$this-Log-Output(' req ', "Request Message".$requestStr);if(!Empty($requestStr)) {$POSTOBJ= Simplexml_load_string ($requestStr, ' SimpleXMLElement ', Libxml_nocdata);$fromUsername=$POSTOBJ-Fromusername;$toUsername=$POSTOBJ-Tousername;$msgType=$POSTOBJ-Msgtype;$keyword= Trim ($POSTOBJ-Content);$arr=Array(' Fromusername '=$fromUsername, ' Tousername '=$toUsername, ' Msgtype '=$msgType,' keyword '=$keyword, ' Postobj '=$POSTOBJ);$responseStr=$this-Controllers-Index($arr);$this-Log-Output(' Res ', "Response message".$responseStr);Echo$responseStr;}Else{Echo'';Exit;} }
The above is part of the code to process the message
It's needless to say, accept the value of name mpXML.
However, after the service-side code is on-line, this should not be accepted to the sending server's request message (XML format).
$GLOBALS ["Http_raw_post_data"] ; //Online release
Or
= file_get_contents ("Php://input"); //Online release
can accept the request message, the second method is recommended, it brings less pressure to memory, and does not require any special php.int settings
The above introduces the public number development---Request service end value problem, including the content, I hope to be interested in PHP tutorial friends helpful.