PHP code example of thanatos915 / umeng

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

    

thanatos915 / umeng example snippets


use Umeng\UmengPush;

$key = "****";
$secret = "*****";
$push = new UmengPush($key, $secret);
$values = [
    'ticker' => '1', // ire 值可以为:
    // "go_app": open app
    // "go_url": 跳转到URL
    // "go_activity": open activity
    // "go_custom": 用户自定义内容。
];
echo $push->sendAndroidUnicast($values, [], 'device token');
# result: {"ret":"SUCCESS","data":{"msg_id":"uu77312149835056871500"}}

$key = "****";
$secret = "*****";
$push = new UmengPush($key, $secret);
$values = [
    'ticker' => '1', // 必填 通知栏提示文字
    'title' => '2', // 必填 通知标题
    'text' => '3', // 必填 通知文字描述
    'after_open' => 'go_app' // 必填 值可以为:
    // "go_app": 打开应用
    // "go_url": 跳转到URL
    // "go_activity": 打开特定的activity
    // "go_custom": 用户自定义内容。
];
echo $push->sendAndroidBroadcast($values, []);
# result: {"ret":"SUCCESS","data":{"task_id":"us41183149835484509400"}}