PHP code example of sunkangchina / getui-pushapi-php-client-v2

1. Go to this page and download the library: Download sunkangchina/getui-pushapi-php-client-v2 library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sunkangchina / getui-pushapi-php-client-v2 example snippets


function pushToSingleByCid(){
	//创建API,APPID等配置参考 环境要求 进行获取
    $api = new GTClient("https://restapi.getui.com","APPKEY", "APPID","MASTERSECRET");
    //设置推送参数
    $push = new GTPushRequest();
    $push->setRequestId("请求唯一标识号");
    $message = new GTPushMessage();
    $notify = new GTNotification();
    $notify->setTitle("设置通知标题");
    $notify->setBody("设置通知内容");
    //点击通知后续动作,目前支持以下后续动作:
    //1、intent:打开应用内特定页面url:打开网页地址。2、payload:自定义消息内容启动应用。3、payload_custom:自定义消息内容不启动应用。4、startapp:打开应用首页。5、none:纯通知,无后续动作
    $notify->setClickType("none");
    $message->setNotification($notify);
    $push->setPushMessage($message);
    $push->setCid("CID");
    //处理返回结果
    $result = $api->pushApi()->pushToSingleByCid($push);
}

function queryPushResultByDate(){
    //创建API,APPID等配置参考 环境要求 进行获取
    $api = new GTClient("https://restapi.getui.com","APPKEY", "APPID","MASTERSECRET");
    //处理返回结果
    $result = $api->statisticsApi()->queryPushResultByDate("年-月-日");
}

function queryUserStatus(){
    //创建API,APPID等配置参考 环境要求 进行获取
    $api = new GTClient("https://restapi.getui.com","APPKEY", "APPID","MASTERSECRET");
    $array = array(CID1);
    //处理返回结果
    $result = $api->userApi()->queryUserStatus($array);
}

        "getui_http_proxy_ip" : 代理ip
        "getui_http_proxy_port" : 代理端口
        "getui_http_proxy_username" : 鉴权用户名
        "getui_http_proxy_passwd" : 鉴权密码