PHP code example of xiaosongshu / appmessage

1. Go to this page and download the library: Download xiaosongshu/appmessage 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/ */

    

xiaosongshu / appmessage example snippets



Xiaosongshu\Appmessage\Message;
/** 你的APPid */
$appId = '1';
/** 你的APPkey */
$appkey = '2';
/** secret */
$mastersecret = '3';
/** 个推baseurl */
$baseUrl = 'https://restapi.getui.com/v2/1';
/** 包名称 */
$packagename  = '4';
/** 实例化客户端 */
$client= new Message( $appId, $appkey, $mastersecret, $baseUrl, $packagename);
/** 单个推送 */
$res = $client->send_one(['title'=>'demo','content'=>'','url'=>'','cid'=>'']);
/** 批量推送 */
$res = $client->send_list(['title'=>'demo','content'=>'','url'=>'','cids'=>'']);
/** 全部推送 */
$res=$client->send_all(['title'=>'demo','content'=>'','url'=>'']);

/** 成功 */
$res = ['code' => 200, 'msg' => "", 'data' =>[]];
/** 失败 */
$res = ['code' => 400, 'msg' => "", 'data' =>[]];