PHP code example of snow / apple

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

    

snow / apple example snippets


use Snow\Apple\Apple;
use Snow\Apple\Technology\SearchAds\CampaignGetAll;
use Snow\Apple\Technology\SearchAds\AdGroupLevelReports;

$privateKey = 'xxx';
$publicKey = 'xxxx';
$clientId = 'xxx';
$teamId = 'xxxx';
$keyId = 'xxx';
$audience = 'xxx';
$alg = 'ES256';

$app = new Apple($privateKey, $publicKey, $clientId, $teamId, $keyId, $audience, $alg);

// 获取数据,分页默认limit 10, offset 0
$data = $app->execute(CampaignGetAll::class);

// 分页
$data = $app->execute(CampaignGetAll::class, 0, 1000);

$campaignId = 100000;
$data = $app->execute(AdGroupLevelReports::class, $campaignId, [
            'selector' => [
                'orderBy' => [
                    [
                        'field' => 'installs',
                        'sortOrder' => 'ASCENDING',
                    ]
                ]
            ],
            'granularity' => 'DAILY',
            'startTime' => '2021-06-22',
            'endTime' => '2021-06-28',
        ]);