php教程|php手册
大数据,微博,粉丝,
php教程-php手册
微博粉丝平台开发最便捷的方法是从微信迁移过来,不过微博粉丝平台对此做了些改动。
c 网页代码源码下载,vscode安装中文包,ubuntu 开发代号,用tomcat运行jsp,爬虫youtube视频,php漏洞挖掘之旅,西湖区seo优化方法,网站产品分类代码,discuz模板 19楼lzw
以下引用自:/wiki/%E5%BE%AE%E4%BF%A1%E5%BC%80%E5%8F%91%E8%80%85%E8%BF%81%E7%A7%BB%E6%8C%87%E5%8D%97
票据打印源码,vscode有没有工具条,ubuntu 调试 参数,tomcat环境配置检查,java.爬虫,php项目报告,seo和sem营销策略怎么写lzw
所以,我们对微信平台的代码稍加改动,便能很好的运用在微博了。
文档资产管理系统源码,ubuntu 添加公钥,在tomcat下挂载项目,爬虫异步库,php用html编写季节,seo查阅lzw
下面贴出源码:
valid();class weiboChatApi{public function valid() { $echoStr = $_GET["echostr"]; //valid signature , option if($this->checkSignature()){ echo $echoStr; exit; } } public function responseMsg() {//get post data, May be due to the different environments$postStr = $GLOBALS["HTTP_RAW_POST_DATA"];//extract post dataif (!empty($postStr)){ $postObj = simplexml_load_string($postStr, SimpleXMLElement, LIBXML_NOCDATA);$fromUsername = $postObj->FromUserName;$toUsername = $postObj->ToUserName;$keyword = trim($postObj->Content);$time = time();$textTpl = "<![CDATA[%s]]><![CDATA[%s]]>%s<![CDATA[%s]]><![CDATA[%s]]>0"; if(!empty( $keyword )){ $msgType = "text";$contentStr = "Welcome to weibo world!";$resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);echo $resultStr;}else{echo "Input something...";} }else { echo ""; exit; } }private function checkSignature(){ $signature = $_GET["signature"]; $timestamp = $_GET["timestamp"]; $nonce = $_GET["nonce"]; $token = SECRET; // 与微信不同,用APP_SECRET验证$tmpArr = array($token, $timestamp, $nonce);sort($tmpArr, SORT_STRING);$tmpStr = implode( $tmpArr );$tmpStr = sha1( $tmpStr );if( $tmpStr == $signature ){return true;}else{return false;}}}?>
上文中提到的APPKEY和APPSECRET可在 /apps 注册应用后获得。
—————————————————————————————– good lunk!