1. Go to this page and download the library: Download wecantrack/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/ */
use WeCanTrack\API\{Networks, NetworkAccounts};
$accounts = (new NetworkAccounts(API_KEY))->get();
foreach($accounts as $account) {
echo $account['id'];
echo $account['name'];
echo $account['network_id'];
echo $account['is_enabled'];
......
}
echo $accounts->getCount(); // return Accounts count
// get single account data by id
$account = $accounts->findById(123);
echo $account['id'];
echo $account['name'];
echo $account['network_id'];
echo $account['is_enabled'];
use WeCanTrack\API\{Networks, NetworkAccounts};
$networkAccounts = new NetworkAccounts(API_KEY);
$accounts = $networkAccounts->ids(12)->get(); // get account where its id = 12
// or
$accounts = $networkAccounts->ids([12, 123, 1234])->get(); // get accounts where its ids are 12, 123, 1234
foreach($accounts as $account) {
echo $account['id'];
echo $account['name'];
echo $account['network_id'];
echo $account['is_enabled'];
......
}
echo $accounts->getCount(); // return Accounts count
use WeCanTrack\API\Websites
$websites = (new Websites(API_KEY))->get();
foreach($websites as $data) {
echo $data['id'];
echo $data['url'];
echo $data['active'];
}
// get single website data by id
$data = $websites->findById(123);
echo $data['id'];
echo $data['url'];
echo $data['active'];
use WeCanTrack\API\Transactions;
$startDate = '2019-01-01';
$endDate = '2019-01-31';
$records = (new Transactions(API_KEY))->get($startDate, $endDate);
foreach($records as $row) {
echo $row['transaction_id'];
echo $row['reference']; // return wct200514135314e7x4d
echo $row['order_date'];
echo $row['validation_date'];
echo $row['status'];
echo $row['sale_amount'];
echo $row['commission_amount'];
var_dump($row['click_metadata']);
......
}
echo $records->getTotalCount(); // get all record count.
use WeCanTrack\API\Transactions;
$startDate = '2019-01-01';
$endDate = '2019-01-31';
$records = (new Transactions(API_KEY))
->networkAccountId(123)
->status([
Transactions::STATUS_PENDING,
Transactions::STATUS_APPROVED,
])
->get($startDate, $endDate, Transactions::LAST_WCT_UPDATE);
foreach($records as $row) {
echo $row['transaction_id'];
echo $row['reference']; // return wct200514135314e7x4d
......
}
echo $records->getTotalCount(); // get all record count.
use WeCanTrack\API\Transactions;
$startDate = '2019-01-01';
$endDate = '2019-01-31';
$records = (new Transactions(API_KEY))
->status([
Transactions::STATUS_PENDING,
])
->get($startDate, $endDate);
// every page request return max 500 rows only
foreach($records->limit(500) as $row) {
echo $row['transaction_id'];
echo $row['reference']; // return wct200514135314e7x4d
......
}
echo $records->getTotalCount(); // get all record count.
use WeCanTrack\API\Transactions;
$startDate = '2019-01-01';
$endDate = '2019-01-31';
$records = (new Transactions(API_KEY))
->status([
Transactions::STATUS_PENDING,
])
->get($startDate, $endDate);
// return max 600 rows from page 3 only.
foreach($records->limit(600)->page(3) as $row) {
echo $row['transaction_id'];
echo $row['reference']; // return wct200514135314e7x4d
......
}
echo $records->getTotalCount(); // get all record count.
echo $records->getCount(); // get the rows count for current page.
t
use WeCanTrack\Helper\Utilities;
echo Utilities::extractReference($url); // return wct200514135314e7x4d
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.