PHP code example of westng / oceanengine-sdk-php

1. Go to this page and download the library: Download westng/oceanengine-sdk-php 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 / oceanengine-sdk-php example snippets




declare(strict_types=1);
/**
 * This file is part of Marketing PHP SDK.
 *
 * @link     https://github.com/westng/oceanengine-sdk-php
 * @document https://github.com/westng/oceanengine-sdk-php
 * @contact  westng
 * @license  https://github.com/westng/oceanengine-sdk-php/blob/main/LICENSE
 */
use OceanEngineSDK\OceanEngineAuth;

// 申请广告主授权URL
$auth = new OceanEngineAuth(APPID, SECRET);
$auth->getAuthCodeUrl(CALLBACK_URL, null, AUTH_CODE, 'AD')

// 获取授权
$auth->getAccessToken(AUTH_CODE)

// 刷新授权
$auth->refreshToken(REFRESH_TOKEN)

// 业务接口需要调用
$client = $auth->makeClient(TOKEN);
$args = [
    // 业务接口请求参数
];
$req = $client::JuLiangQianChuan()
        ->AccountRel
        ->AwemeAuthorizedGet()
        ->setArgs($args)
        ->send();

var_dump($req->getBody());

.
src/
├── AdOauth/
│   ├── GetAccessToken.php // 获取access_token
│   └── RefreshToken.php // 刷新access_token
├── Core/
│   ├── Autoloader/
│   │   └── Autoloader.php
│   ├── Exception/
│   ├── Helper/
│   ├── Http/
│   └── Profile/
├── Api/
│   ├── JuLiangAds/ // 接口平台目录
│   │   ├── AccountMgmt/ // 一级接口目录
│   │   │   ├── AccountInfo/ // 二级接口目录 
│   │   │   ├── AccountRel/ // 二级接口目录
│   │   │   │   ├── AwemeAuthorizedGet.php // 具体接口文件
│   │   │   │   ├── Module.php
│   │   └── Module.php
│   ├── EnterpriseAccount/
│   └── JuLiangLocalPush/
├── test
├── LICENSE
└── README.md
shell
composer