-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathexample.php
44 lines (35 loc) · 1.83 KB
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
require_once __DIR__ . '/vendor/autoload.php';
use yedincisenol\DynamicLinks\Info\Analytics\GooglePlayAnalytics;
use yedincisenol\DynamicLinks\Info\Analytics\ItunesConnectAnalytics;
use yedincisenol\DynamicLinks\Info\AnalyticsInfo;
use yedincisenol\DynamicLinks\DynamicLink;
use yedincisenol\DynamicLinks\Info\AndroidInfo;
use yedincisenol\DynamicLinks\Info\SocialMetaTag;
use yedincisenol\DynamicLinks\Info\IosInfo;
$apiKey = 'AIzaSyBimuzHmQKpSV2TkQTJnwtodfciaFY8XpE';
$dynamicLinkDomain = 'rcw3r.app.goo.gl';
$longLink = 'https://rcw3r.app.goo.gl/?link=https://example.com/&apn=com.example.android&ibi=com.example.ios';
$dynamicLink = new yedincisenol\DynamicLinks\DynamicLinks([
'api_key' => $apiKey,
'dynamic_link_domain' => $dynamicLinkDomain
]);
// ****** //
//Create new short link from Simple Data
$link = new yedincisenol\DynamicLinks\DynamicLink('http://yeni.co/');
##$shortLink = $dynamicLink->create($link, 'UNGUESSABLE');
// ****** //
//Create new shortlink from Advanced Data
$androidInfo = new AndroidInfo('co.yeni.dynamiclinks', 'fallbacklink', '15', 'http://play.google.com/apps/yenico');
$iosInfo = new IosInfo('co.yeni.dynamiclinks', 'http://yeni.co/', null, 'http://yeni.co', 'bundleid', 'storeid');
$analyticsInfo = new AnalyticsInfo(
new GooglePlayAnalytics('gclid', 'utm', 'utmterm', 'utmcampaign', 'utmmedium', 'utmsorce'),
new ItunesConnectAnalytics('at', 'ct', 'mt', 'pt')
);
$socialMediaTag = new SocialMetaTag('title', 'description', 'http://yeni.co/preview-image.jpg');
$link = new DynamicLink('http://yeni.co/post?id=15&ref=at#detail', $androidInfo, $iosInfo, true, $analyticsInfo, $socialMediaTag);
$shortLink = $dynamicLink->create($link, 'SHORT');
// ****** //
//Create new shortlink from Long Link
//$shortLink = $dynamicLink->shorten($longLink);
print_r($shortLink);