-
Notifications
You must be signed in to change notification settings - Fork 1
/
examples.php
158 lines (132 loc) · 5.3 KB
/
examples.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?php
/*
Some examples usages of the various API methods
The API methods are described in https://socialadr.dev/pg/apps/api-methods
To find your Client ID, Client Secret, and App ID, go to https://socialadr.com/pg/apps/manage and click "Manage" for your app
*/
require('SocialAdrAPI.php');
$clientId = ''; // Your Client ID
$clientSecret = ''; // Your Client Secret
$appId = ''; // Your App ID
$accessToken = ''; // The Access Token for this user, typically retrieved from your database
$SocialAdr = new SocialAdrAPI($clientId, $clientSecret, $appId);
$SocialAdr->debug = true;
$SocialAdr->setAccessToken($accessToken);
// Available Credits method
// Get current available credit balance
// $SocialAdr->accountCredits();
$result = $SocialAdr->accountCredits();
print_r($result);
// Validate method
// Find out if it's possible to add a URL into the system, before attempting to do so.
// $SocialAdr->urlValidate($url)
$result = $SocialAdr->urlValidate('https://somesite.com/somepage');
print_r($result);
// List method
// Return a list of bookmarks in an account
// $SocialAdr->urlList($limit)
$result = $SocialAdr->urlList(10);
print_r($result);
// urlAdd method
// Add a new URL that you want to promote.
// $SocialAdr->urlAdd(SocialAdrURL $url)
$myURL = new SocialAdrURL;
$myURL->url = 'https://somesite.com/somepage';
$myURL->title = 'A {great|awesome|cool|fun} webpage';
$myURL->descr = 'This is the {best|most amazing} {webpage|website} I think I have ever {viewed|looked at|seen} in my entire life! {Highly|Definitely} recommend.';
$myURL->tags = 'here,are,some tags';
$myURL->category = 'inte';
$myURL->microblog = 'A {great|awesome|cool|fun} webpage';
$myURL->submitRate = 'normal';
$myURL->submitLimit = 100;
$result = $SocialAdr->urlAdd($myURL);
print_r($result);
// urlUpdate method
// Updates an existing URL.
// $SocialAdr->urlUpdate(SocialAdrURL $url)
$myURL = new SocialAdrURL;
$myURL->guid = 12345;
$myURL->url = 'https://somesite.com/somedifferentpage';
$myURL->title = 'A new {great|awesome|cool|fun} webpage';
$myURL->descr = 'This is now the {best|most amazing} {webpage|website} I think I have ever {viewed|looked at|seen} in my entire life! {Highly|Definitely} recommend.';
$myURL->tags = 'here,are,some,new tags';
$myURL->category = 'inte';
$myURL->microblog = 'A {great|awesome|cool|fun} updated webpage';
$myURL->submitRate = 'fast';
$myURL->submitLimit = 200;
$result = $SocialAdr->urlUpdate($myURL);
print_r($result);
// urlDelete method
// Deletes URL with given guid
// $SocialAdr->urlDelete($guid)
$result = $SocialAdr->urlDelete(12345);
print_r($result);
// urlUndelete method
// Restores deleted URL with given guid
// $SocialAdr->urlUndelete($guid)
$result = $SocialAdr->urlUndelete(12345);
print_r($result);
// urlList method
// Lists URLs
// $SocialAdr->urlList($limit, $offset, $sort, $sort_direction)
$result = $SocialAdr->urlList(15, 0, 'guid', 'asc');
print_r($result);
// urlArchived method
// Lists archived URLs
// $SocialAdr->urlArchived($limit, $offset, $sort, $sort_direction)
$result = $SocialAdr->urlArchived(15, 0, 'guid', 'asc');
print_r($result);
// reportOverview method
// Gives an overview of the latest social submissions for all URLs in an account.
// $SocialAdr->reportOverview($offset,$limit)
$result = $SocialAdr->reportOverview(0,20);
print_r($result);
// reportDetail method
// Gives detailed history of social submissions for a specific URL
// $SocialAdr->reportDetail($url,$offset,$limit)
$result = $SocialAdr->reportDetail('https://somesite.com/somepage',0,20);
print_r($result);
// fblikesAdd method
// Creates a Facebook Likes Campaign with given package for given bookmark
// $SocialAdr->fblikesAdd($url_guid, $package_id)
$result = $SocialAdr->fblikesAdd('794101', 1);
print_r($result);
// fblikesPackages method
// Lists all available packages for Facebook Likes Campaigns, including number of likes, and credits required
$result = $SocialAdr->fblikesPackages();
print_r($results);
// fblikesHistory method
// List Facebook Likes campaigns
// $SocialAdr->fblikesHistory($limit, $offset)
$result = $SocialAdr->fblikesHistory(10, 0);
print_r($results);
// resellerSubaccounts method
// Lists all subaccounts controlled by reseller
// $SocialAdr->resellerSubaccounts()
$results = $SocialAdr->resellerSubaccounts();
print_r($results);
// Reseller Subaccount API call example
// You can call any API call for a subaccount by doing the following
// $SocialAdr->setSubaccountGUID($subaccount_guid);
$SocialAdr->setSubaccountGUID(12345);
$result = $SocialAdr->fblikesHistory(10, 0); //Returns fblikesHistory results for reseller subaccount with guid of 12345
print_r($results);
// Reseller Add API call example
// Creates a Socialadr Account under the control of the reseller
// $SocialAdr->resellerAdd($SocialAdrSubaccount)
$subaccount = new SocialAdrSubaccount();
$subaccount->name='mysubaccount';
$subaccount->credits=5000;
$subaccount->twitter=true;
$subaccount->facebook_likes=true;
$subaccount->google_plus=true;
$subaccount->linkedin=true;
$subaccount->pinterest=true;
$subaccount->disable=true;
$addSub = $SocialAdr->resellerAdd($subaccount);
print_r($addSub);
// Reseller Credits API call example
// Transfers credits from the reseller account to the subaccount
// $SocialAdr->resellerCredits($subaccount_guid, $credits);
$SocialAdr->resellerCredits(103425, 1000); //Transfers 1000 credits to subaccount
?>