PHP code example of wildlink / wildlink-api-php

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

    

wildlink / wildlink-api-php example snippets


// minimum auth, NOTE: this creates a new device
$wfClient = new WildlinkClient($app_id, $secret);

// create a new "session" for a previously created device (fetches a new deviceToken from Wildfire server)
$wfClient = new WildlinkClient($app_id, $secret, $device_key);

// prepare to make a new request with a previously stored device key and device auth token (no Wildfire server hit)
$wfClient = new WildlinkClient($app_id, $secret, $device_key, $device_token);

echo $wfClient->device_key; // Device Key is used for authing the device in the future - it doesn't expire
echo $wfClient->device_id; // Device ID is used for referencing device in reporting data
echo $wfClient->device_token; // Device Token is used for authing device - it expires

// single merchant request
$singleMerchant = $wfClient->getMerchantsById(5477615);
var_dump($singleMerchant);

// multiple merchant request
$multipleMerchants = $wfClient->getMerchantsById(array(5482877,5478747));
var_dump($multipleMerchants);

$singleMerchantCommissionRates = $wfClient->getMerchantCommissionRates(5477615);
var_dump($singleMerchantCommissionRates);

$merchantList = new MerchantList($wfClient);
while ($merchant = $merchantList->getCurrentMerchant()){
    var_dump($merchant);
    if ($merchantList->hasNextMerchant()){
        $merchantList->getNextMerchant();
    } else {
        break;
    }
}

$allCommissionsSince = $wfClient->getAppCommissionsSince('2018-07-01');
var_dump($allCommissionsSince);

use WildlinkApi\CommissionList;

$commissionList = new CommissionList($wfClient, '2018-12-01');

while ($commission = $commissionList->getCurrentCommission()){
    var_dump($commission);
    if ($commissionList->hasNextCommission()){
        $commissionList->getNextCommission();
    } else {
        break;
    }
}

$commissionSummary = $wfClient->getCommissionSummary();
var_dump($commissionSummary);

$commissions = $wfClient->getCommissionDetails();
var_dump($commissions);

$clicks = $wfClient->getClickStatsByDay('2018-01-01');
var_dump($clicks);

$vanityUrl = $wfClient->getVanityUrl('https://www.walmart.com/ip/VIZIO-24-Class-HD-720P-LED-TV-D24hn-G9/782959488');
var_dump($vanityUrl);
composer 

stdClass Object
(
    [PendingAmount] => 0.00
    [ReadyAmount] => 0.00
    [PaidAmount] => 0.00
)