PHP code example of westng / xhs-marketing-api

1. Go to this page and download the library: Download westng/xhs-marketing-api 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/ */

    

westng / xhs-marketing-api example snippets


// 获取token, refresh_token
$auth = new XHSSdk\XHSAuth(APPID, SECRET);
print_r($auth->getAccessToken(AUTH_CODE));

// 刷新token
print_r($auth->refreshToken(REFRESH_TOKEN));

// 调用示例
$client = new XHSSdk\XHSClient(TOKEN);
$args = [];
$req = $client::AdvertisingDelivery()->campaignGet()->setArgs($args)->send();
var_dump($req->getBody());