コード例 #1
0
ファイル: class.act.wx.php プロジェクト: GStepOne/CI
 /**
  * 合法性验证
  * 文档地址:http://mp.weixin.qq.com/wiki/index.php?title=%E6%8E%A5%E5%85%A5%E6%8C%87%E5%8D%97
  */
 function _yanzhengAct()
 {
     define("TOKEN", "cailai123");
     $wechatObj = new wechatCallbackapiTest();
     $wechatObj->valid();
     exit;
 }
コード例 #2
0
<?php

//功能是提供大转盘的兑换,目前是加积分2,且只有一个奖项
$wechatObj = new wechatCallbackapiTest();
$wechatObj->responseMsg();
class wechatCallbackapiTest
{
    public function responseMsg()
    {
        $keyword = trim($_GET['quan']);
        $fromUsername = $_GET['name'];
        require_once 'conn.php';
        preg_match_all("/[A-Za-z0-9]/", $keyword, $match01);
        $select = $match01[0];
        foreach ($select as $val) {
            $abc .= $val;
        }
        $item = substr($abc, 4, 2);
        //创建时间记录
        $t = time();
        $datestamp = date("Y-m-d H:i:s", $t);
        //更新历史列表
        $checklist = mysql_fetch_array(mysql_query("select * from shop_history where secret = '{$abc}'"));
        if (!empty($checklist) && $checklist['used'] == "NO") {
            mysql_query("UPDATE shop_history SET used = 'YES', usedtime='{$datestamp}' WHERE secret = '{$abc}'");
            //获取积分
            $result_jifen = mysql_fetch_array(mysql_query("select * from jifen where user like '%{$fromUsername}%'"));
            if ($item == "04") {
                $score_changed = $result_jifen['score'] + 4;
                //增加积分量
            } elseif ($item == "01") {
コード例 #3
0
ファイル: wx_sample.php プロジェクト: sirxun/uploadImag
<?php

/**
 * wechat php test
 */
//define your token
define("TOKEN", "baigungun");
$wechatObj = new wechatCallbackapiTest();
$wechatObj->valid();
class wechatCallbackapiTest
{
    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 data
        if (!empty($postStr)) {
            /* libxml_disable_entity_loader is to prevent XML eXternal Entity Injection,
               the best way is to check the validity of xml by yourself */
            libxml_disable_entity_loader(true);
            $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
            $fromUsername = $postObj->FromUserName;
コード例 #4
0
ファイル: wx_sample.php プロジェクト: will0306/bianli100
<?php

/**
 * wechat php test
 */
//define your token
define("TOKEN", "weixin");
$wechatObj = new wechatCallbackapiTest();
$wechatObj->valid();
$wechatObj->responseMsg();
class wechatCallbackapiTest
{
    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 data
        if (!empty($postStr)) {
            $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
            $fromUsername = $postObj->FromUserName;
            $toUsername = $postObj->ToUserName;
            $keyword = trim($postObj->Content);
コード例 #5
0
ファイル: icoding.php プロジェクト: roryliu/icoding
<?php

require_once 'weixinlib/textmsg.php';
require_once 'weixinlib/secretmsg.php';
require_once 'weixinlib/clickmsg.php';
define('TOKEN', 'icoding520');
$wechatObj = new wechatCallbackapiTest();
$wechatObj->response();
class wechatCallbackapiTest
{
    public function response()
    {
        $echoStr = $_GET['echostr'];
        //valid signature , option
        if ($this->checkSignature()) {
            echo $echoStr;
            $this->responseMsg();
            exit;
        }
    }
    public function responseMsg()
    {
        //get post data, May be due to the different environments
        $postStr = $GLOBALS['HTTP_RAW_POST_DATA'];
        //extract post data
        if (!empty($postStr)) {
            $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
            $fromUsername = $postObj->FromUserName;
            $toUsername = $postObj->ToUserName;
            $getMsgType = $postObj->MsgType;
            $PicUrl = '';
コード例 #6
0
ファイル: index.php プロジェクト: AnderLX/wechat
<?php

require_once "config.php";
/**
 * wechat php test
 */
//define your token
define("TOKEN", "woijodsj23232jdofijweo323ioj");
$wechatObj = new wechatCallbackapiTest();
//$wechatObj->valid();
$wechatObj->setAppid($appid, $secret);
$wechatObj->responseMsg();
class wechatCallbackapiTest
{
    private $appid;
    private $secret;
    public function setAppid($appid, $secret)
    {
        $this->appid = $appid;
        $this->secret = $secret;
    }
    public function valid()
    {
        $echoStr = $_GET["echostr"];
        //valid signature , option
        if ($this->checkSignature()) {
            echo $echoStr;
            exit;
        }
    }
    public function responseMsg()
コード例 #7
0
<?php

header("content-type:text/html;charset=utf-8");
// echo "klkdlkl";die;
require_once '../common/php/dbaccess.php';
require_once '../common/php/configSelf.php';
require_once 'sdk_sunpeijun.php';
require_once '../common/php/config.php';
traceHttp();
define("TOKEN", "weixin");
//微信端验证token
define('IP', "www.chinwhiz.cn");
$db = new DB();
$wechatObj = new wechatCallbackapiTest();
$access_token = $wechatObj->getAccessToken($appIdSelf, $appSecretSelf);
$wx = new wechat($appIdSelf, $appSecretSelf, $access_token);
if (isset($_GET['echostr'])) {
    $wechatObj->valid();
} else {
    //$wx->sendMsgToAll();
    $wechatObj->responseMsg();
    //  	$wechatObj->createMenu();
}
class wechatCallbackapiTest
{
    public function valid()
    {
        $echoStr = $_GET["echostr"];
        if ($this->checkSignature()) {
            ob_clean();
            echo $echoStr;
コード例 #8
0
ファイル: testii.php プロジェクト: roryliu/icoding
<?php 
/**
 * wechat php test
 */
include 'weixinlib/textmsg.php';
include 'weixinlib/secretmsg.php';
$wechatObj = new wechatCallbackapiTest();
$wechatObj->responseMsg('<xml><ToUserName><![CDATA[gh_3b9f2b7cbeb1]]></ToUserName>
<FromUserName><![CDATA[onJi-jkBg94_yLkoQLmlVFDTPqfk]]></FromUserName>
<CreateTime>1364050029</CreateTime>
<MsgType><![CDATA[text]]></MsgType>
<Content><![CDATA[kk]]></Content>
<MsgId>5858550264762860409</MsgId>
</xml>');
class wechatCallbackapiTest
{
    public function valid()
    {
        $echoStr = $_GET['echostr'];
        //valid signature , option
        if ($this->checkSignature()) {
            echo $echoStr;
            $this->responseMsg();
            exit;
        }
    }
    public function responseMsg($postStr)
    {
        //get post data, May be due to the different environments
        //	$postStr = $GLOBALS['HTTP_RAW_POST_DATA'];
        //extract post data
コード例 #9
0
<?php

header('content-type:text/html;charset=utf-8');
ini_set("display_errors", "Off");
define("TOKEN", $_GET['token']);
date_default_timezone_set("PRC");
$wechatObj = new wechatCallbackapiTest();
$check_attached = $wechatObj->chaxun(0, $_GET['token'], 'get_member_detail');
$checked_info = mysql_fetch_array($check_attached);
if ($checked_info['attached'] == 0) {
    $wechatObj->chaxun(0, TOKEN, 'updateattach');
}
if (isset($_GET['echostr'])) {
    $wechatObj->valid();
}
define('uf', $_GET['token']);
define("serverip", $_SERVER['HTTP_HOST']);
$wechatObj->response(TOKEN);
class wechatCallbackapiTest
{
    private $timestamp;
    public $temp;
    public $row = 0;
    public $fromUsername;
    public $toUsername;
    public $firstView = true;
    public $firstViewWord = true;
    public $viewId;
    public $viewing = 0;
    public $piao = 0;
    public $now;
コード例 #10
0
ファイル: weixin.php プロジェクト: zekaigit/yijianchelian
<?php

/**
 * wechat php test
 */
require_once "src/JPush/JPush.php";
use sinacloud\sae\Storage;
error_reporting(E_ALL ^ E_NOTICE);
define("TOKEN", "weixin");
$wechatObj = new wechatCallbackapiTest();
if (isset($_GET['echostr'])) {
    $wechatObj->valid();
} else {
    $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
    if (!empty($postStr)) {
        libxml_disable_entity_loader(true);
        $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
        $fromUsername = $postObj->FromUserName;
        $toUsername = $postObj->ToUserName;
        $type = $postObj->MsgType;
        $customevent = $postObj->Event;
        $latitude = $postObj->Location_X;
        //获取纬度
        $longitude = $postObj->Location_Y;
        //获取经度
        $label = $postObj->Label;
        //获取地理信息
        $voice = $postObj->Recognition;
        //为语音识别结果
        $keyword = trim($postObj->Content);
        $time = time();
コード例 #11
0
ファイル: weixin.php プロジェクト: XinRan5312/webot
<?php

require 'config.php';
$wechatObj = new wechatCallbackapiTest();
$wechatObj->valid();
require 'ImagePoster.php';
$wechatObj->forwardToWeibo();
class wechatCallbackapiTest
{
    var $poster;
    public function valid()
    {
        $echoStr = $_GET["echostr"];
        //valid signature , option
        if ($this->checkSignature()) {
            echo $echoStr;
        }
    }
    public function forwardToWeibo()
    {
        $this->poster = new ImagePoster();
        //get post data, May be due to the different environments
        $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
        //extract post data
        if (!empty($postStr)) {
            $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
            $msgType = $postObj->MsgType;
            $fromUsername = $postObj->FromUserName;
            $key = $fromUsername . 'key';
            $toUsername = $postObj->ToUserName;
            if ($msgType == 'image') {
コード例 #12
0
ファイル: Jizipu.php プロジェクト: codekissyoung/kanjiebao
 public function index()
 {
     /*{{{*/
     $wechatObj = new wechatCallbackapiTest();
     if (isset($_GET['echostr'])) {
         $wechatObj->valid();
     } else {
         $wechatObj->responseMsg();
     }
 }
コード例 #13
0
ファイル: setup.php プロジェクト: 0ostreamo0/CallRepair
<?php

define('TOKEN', 'weixin');
define('APP_ID', 'wx2bac5dc50633192c');
define('APP_SECRET', '8a7b3729c3187dd130a1e77c515e5025');
$wechatObj = new wechatCallbackapiTest();
if (isset($_GET['echostr'])) {
    $wechatObj->valid();
} else {
    //$wechatObj->responseMsg();
    $wechatObj->Run();
}
//$wechatObj->Run();
class wechatCallbackapiTest
{
    private $fromUsername;
    private $toUsername;
    private $time;
    private $keyword;
    private $app_id;
    private $app_secret;
    private $data;
    private $token;
    public function __construct()
    {
        $this->app_id = APP_ID;
        $this->app_secret = APP_SECRET;
        $this->token = TOKEN;
        $this->data = '{' . '"button":[' . '{"name":"马上报修","type":"view","url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx2bac5dc50633192c&redirect_uri=http%3a%2f%2frepairtest.sinaapp.com%2fTiketRaise.php&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"},' . '{"name":"工单查询","type":"view","url":"http://repairtest.sinaapp.com/ServiceDesk.php"}' . ']}';
    }
    /**
コード例 #14
0
ファイル: index.php プロジェクト: dlpc/Weather-weixin
<?php

/**
 * wechat php test
 */
//define your token
define("TOKEN", "weather");
$wechatObj = new wechatCallbackapiTest();
//$wechatObj->valid();
//$wechatObj->responseMsg();
$wechatObj->responseImgMsg();
class wechatCallbackapiTest
{
    public function valid()
    {
        $echoStr = $_GET["echostr"];
        //valid signature , option
        if ($this->checkSignature()) {
            echo $echoStr;
            exit;
        }
    }
    public function responseImgMsg()
    {
        //get post data, May be due to the different environments
        $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
        //extract post data
        if (!empty($postStr)) {
            $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
            $fromUsername = $postObj->FromUserName;
            $toUsername = $postObj->ToUserName;
コード例 #15
0
ファイル: weixin.php プロジェクト: shonve/i-Pper
<?php

/**
 * wechat php test
 */
//define your token
//define("TOKEN", "hillock");
require_once 'config.php';
$wechatObj = new wechatCallbackapiTest();
$wechatObj->index();
//include 'SimpleImage.php';
class wechatCallbackapiTest
{
    public function index()
    {
        if ($_SERVER['REQUEST_METHOD'] == "POST") {
            $this->responseMsg();
        } else {
            if ($_SERVER['REQUEST_METHOD'] == "GET") {
                $this->valid();
            } else {
                // OTHER
            }
        }
    }
    public function valid()
    {
        $echoStr = $_GET["echostr"];
        //valid signature , option
        if ($this->checkSignature()) {
            echo $echoStr;