This article is mainly to share with you the PHP implementation of the model public developers, mainly in the form of code and we share, hope to help everyone.
$url = ' http://xxxx.com/test/aaaa/index.php ';//Developer Url$token = ' Weixin ';//token $timestamp = $_get["Timestam P "]; $nonce = $_get["nonce"]; $TMPARR = Array ($token, $timestamp, $nonce); Sort ($TMPARR, sort_string); $TMPSTR = implode ($TMPARR); $TMPSTR = SHA1 ($TMPSTR); $url. = Stripos ($url, '? ') = = = False? '? ': ' & '; $url. = http_build_query (' signature ' = ' = ' $tmpStr, ' timestamp ' = $ti Mestamp, ' nonce ' = $nonce,));//echo $url;//If the event is not a project-related $RETURNSTR return null $header = arr Ay ();//this to add ah $header[] = "content-type:text/xml";//define content-type as Xml$ch = Curl_init (); curl_setopt ($ch, Curlopt_url , $url); curl_setopt ($ch, Curlopt_returntransfer, 1); curl_setopt ($ch, Curlopt_httpheader, $header); curl_setopt ($ch, Curlopt_post, 1); curl_setopt ($ch, Curlopt_postfields, $POSTSTR);//curl_setopt ($ch, Curlopt_postfields, $pp); $response = Curl_exec ($ch); if (Curl_errno ($ch)) {Error_log (Curl_error ($ch));} Curl_close ($ch); echo $response;//Return to Server