【求助求助】卡在第一步了

最近在做微信公众号开发,也是免费搞了一个月的阿里服务器,舍不得让它闲着,在开发微信公众号中遇到一个问题:
官方文档

  1. 申请服务器
  2. 搭建服务--------- ali linux镜像apache php5.6 mysql svn一套全有
  3. 申请公众号------没问题正常往下走
  4. 开发者基本配置----到这里,卡住了
    服务器地址URL这个就不会设置了看网上好多版本,有http://外网IP / wx的
    http://IP/api.php
    我在官网下载的demo.php
<?php

include_once "wxBizMsgCrypt.php";

// 第三方发送消息给公众平台
$encodingAesKey = "m8CKj2n79wuROBIrxiol8HP67ULlEFAYdjrm4BBQUD5";
$token = "weixin";
$timeStamp = "1409304348";
$nonce = "xxxxxx";
$appId = "wxd98bf0b4e32deaa4";
$text = "<xml><ToUserName><![CDATA[oia2Tj我是中文jewbmiOUlr6X-1crbLOvLw]]></ToUserName><FromUserName><![CDATA[gh_7f083739789a]]></FromUserName><CreateTime>1407743423</CreateTime><MsgType><![CDATA[video]]></MsgType><Video><MediaId><![CDATA[eYJ1MbwPRJtOvIEabaxHs7TX2D-HV71s79GUxqdUkjm6Gs2Ed1KF3ulAOA9H1xG0]]></MediaId><Title><![CDATA[testCallBackReplyVideo]]></Title><Description><![CDATA[testCallBackReplyVideo]]></Description></Video></xml>";


$pc = new WXBizMsgCrypt($token, $encodingAesKey, $appId);
$encryptMsg = '';
$errCode = $pc->encryptMsg($text, $timeStamp, $nonce, $encryptMsg);
if ($errCode == 0) {
    print("加密后: " . $encryptMsg . "\n");
} else {
    print($errCode . "\n");
}

$xml_tree = new DOMDocument();
$xml_tree->loadXML($encryptMsg);
$array_e = $xml_tree->getElementsByTagName('Encrypt');
$array_s = $xml_tree->getElementsByTagName('MsgSignature');
$encrypt = $array_e->item(0)->nodeValue;
$msg_sign = $array_s->item(0)->nodeValue;

$format = "<xml><ToUserName><![CDATA[toUser]]></ToUserName><Encrypt><![CDATA[%s]]></Encrypt></xml>";
$from_xml = sprintf($format, $encrypt);

// 第三方收到公众号平台发送的消息
$msg = '';
$errCode = $pc->decryptMsg($msg_sign, $timeStamp, $nonce, $from_xml, $msg);
if ($errCode == 0) {
    print("解密后: " . $msg . "\n");
} else {
    print($errCode . "\n");
}

设置好了 总是报错
提示Token 令牌错了
需要一个老师指点迷津!

猜你喜欢

转载自blog.csdn.net/lvdengxiaxieerduo/article/details/82222289