微信企业号开发:首次开启回调模式

<?php

	include "../libs/weixin/WXBizMsgCrypt.php";

//---------------------------------------接口验证-----------------------------------------//
	
	

	// 参数设置
	$encodingAesKey = "2NakyiOvqqTIDW8GPUVnVxnCBO2mQIRsBQXuWsQWLCN";
	$token = "iuk83T8ejUzJLmADW6C4";
	$corpId = "wx661c1bed18ad67c4";

	

	// 获取GET
	$signature = $_GET['msg_signature'];
	$timestamp = $_GET['timestamp'];
	$nonce = $_GET['nonce'];
	$echostr = $_GET['echostr'];
	
	// 返回的明文
	$returnString;

	

	$wxcpt = new WXBizMsgCrypt($token, $encodingAesKey, $corpId);

	
	$errCode = $wxcpt->VerifyURL($signature, $timestamp, $nonce, $echostr, $returnString);
	if ($errCode == 0) {
		echo $returnString;
	} else {
		echo "Weixin Connect Error Code: " . $errCode;
	}

?>

  

posted @ 2015-06-21 23:17  陈朔  阅读(297)  评论(0)    收藏  举报