PHP code example of wuheng / aliyun-open-api-push

1. Go to this page and download the library: Download wuheng/aliyun-open-api-push 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/ */

    

wuheng / aliyun-open-api-push example snippets

 php
//初始化 核心sdk
new Aliyun\Core\Config();

$accessKeyId     = '你的accessKeyId '; 
$accessKeySecret = '你的 accessKeySecret';


 
$iClientProfile = Aliyun\Core\Profile\DefaultProfile::getProfile("cn-hangzhou", $accessKeyId, $accessKeySecret);
$client         = new \Aliyun\Core\DefaultAcsClient($iClientProfile);
$request        = new \Alicloud\Push\Request\V20160801\PushRequest();

//中间各种初始化 赋值操作 
//详情看 vendor\wuheng\aliyun-open-api-push\Push\Request\V20160801\PushRequest.php
//里面的代码

$request->setAppKey('你的用用 appkey');
$request->setTitle('推送标题'); 
$request->setBody('推送内容'); 

//各种参数 赋值
//.......................................

//发送推送
$client->getAcsResponse($this->request);