mpwang / WeChatAPI

Simple WeChat API in PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple WeChatAPI in PHP

Usage Example

include_once 'WeChatAPI.php';

public function responseMsg()
{
    $api = new WeChatAPI();
    $postData = $GLOBALS["HTTP_RAW_POST_DATA"];
    if (empty($postData)) {
        if (!empty($_GET["echostr"])) {
            $api->validate();
        } else {
            echo "server works";
        }
    } else {
        $msg = new MessageClass($postData);
        if ($msg->isSubscribe()) {
            // do something
        }
    }
}

About

Simple WeChat API in PHP

License:MIT License


Languages

Language:PHP 100.0%