PHP code example of toneflix-code / adf-ly-laravel
1. Go to this page and download the library: Download toneflix-code/adf-ly-laravel 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/ */
toneflix-code / adf-ly-laravel example snippets
'providers' => [
...,
ToneflixCode\AdfLy\AdfLyServiceProvider::class,
]
'aliases' => [
...,
'AdfLy' => ToneflixCode\AdfLy\AdfLyFacade::class,
]
use ToneflixCode\AdfLy\AdfLy;
$adfly = new AdfLy;
$res = $adfly->shorten(array('http://stackoverflow.com/users'), 'q.gs');
$shortenedUrl1 = $res['data'][0];
$hash1 = substr($shortenedUrl1['short_url'],strrpos($shortenedUrl1['short_url'],'/')+1);
echo 'First URL shortened (' . $hash1 . '): ' . print_r($res);
$res = $adfly->shorten(array('http://www.reddit.com'), 'q.gs');
$shortenedUrl2 = $res['data'][0];
$hash2 = substr($shortenedUrl2['short_url'],strrpos($shortenedUrl2['short_url'],'/')+1);
echo 'Another URL shortened (' . $hash2 . '): ' . print_r($res);
$res = $adfly->shorten(array('www.youtube.com'), 'q.gs', 'banner');
$shortenedUrl3 = $res['data'][0];
echo 'Another URL shortened: ' . print_r($res);
$res = $adfly->shorten(array('http://www.len10.com/videos/'), 'q.gs', 'int', 13);
$shortenedUrl4 = $res['data'][0];
echo 'Another URL shortened: ' . print_r($res);
function shorten(
array $urls,
$domain = false,
$advertType = false,
$groupId = false,
$title = false,
$customName = false
)
print_r($adfly->expand(array($shortenedUrl3['short_url'],$shortenedUrl4['short_url']),array($hash1,$hash2)));
// List Urls
$urlList = $adfly->getUrls();
print_r($urlList);
// Update Url
$adfly->updateUrl($shortenedUrl1['id'], 'http://modifiedurlaaaa.cat', "int", "The updated URL", 13, false, false);
print_r($adfly->expand(array(),array($hash1)));
foreach($urlList['data'] as $url){
$adfly->deleteUrl($url['id']);
}
//List Urls again
$urlList = $adfly->getUrls();
print_r($urlList);
$g = $adfly->createGroup('API Group');
print_r($g);
$g = $adfly->getGroups(1);
print_r($g);
$res = $adfly->getReferrers();
print_r($res);
$res = $adfly->getCountries();
print_r($res);
$res = $adfly->getAnnouncements();
print_r($res);
$res = $adfly->getPublisherReferrals();
print_r($res);
$res = $adfly->getAdvertiserReferrals();
print_r($res,1);
$res = $adfly->getWithdrawalTransactions();
print_r($res,1);
$res = $adfly->getWithdraw();
print_r($res,1);
$res = $adfly->withdrawRequestInitiate();
print_r($res,1);
$res = $adfly->withdrawRequestCancel();
print_r($res,1);
$res = $adfly->getPublisherStats();
print_r($res,1);
$res = $adfly->getProfile();
print_r($res,1);
$res = $adfly->getAdvertiserCampaigns();
print_r($res,1);
$res = $adfly->getAdvertiserGraph(null,156);
print_r($res,1);
$res = $adfly->getAdvertiserCampaignParts(739026);
print_r($res,1);
$res = $adfly->auth('1', '2');
print_r($res,1);
$res = $adfly->getAccountPubReferrals('', '', 1);
print_r($res);
$res = $adfly->getAccountAdvReferrals('', '', 1);
print_r($res);
$res = $adfly->getAccountPopReferrals('', '', 1);
print_r($res);
$res = $adfly->getAccountTotalReferrals();
print_r($res);
$res = $adfly->getDomains();
print_r($res);
$res = $adfly->updateAccountDetails([]);
print_r($res);
$res = $adfly->updatePassword('oldpassword', 'newpassword', 'newpassword');
print_r($res);
$res = $adfly->getAccountCountries();
print_r($res);
$res = $adfly->getAccountDetails();
print_r($res);
bash
php artisan vendor:publish --provider="ToneflixCode\AdfLy\AdfLyServiceProvider"