forked from socialadr/PHP-SDK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexamples.php
64 lines (48 loc) · 2.18 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
<?php
/*
Some examples usages of the various API methods
The API methods are described in https://docs.google.com/document/d/1Sai2VVAYCcMilB02EzpoTcBbpb0YSNxW_YbCZeJrHlk/edit?usp=sharing
To find your Client ID, Client Secret, and App ID, go to http://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);
// Validate method
// Find out if it's possible to add a URL into the system, before attempting to do so.
$result = $SocialAdr->urlValidate('http://somesite.com/somepage');
print_r($result);
// urlAdd method
// Add a new URL that you want to promote.
$myURL = new SocialAdrURL;
$myURL->url = 'http://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);
// reportOverview method
// Gives an overview of the latest social submissions for all URLs in an account.
$result = $SocialAdr->reportOverview(0,20);
print_r($result);
// reportDetail method
// Gives detailed history of social submissions for a specific URL
$result = $SocialAdr->reportDetail('http://somesite.com/somepage',0,20);
print_r($result);
//fblikesAdd method
// Creates a Facebook Likes Campaign with given package for given bookmark
$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);
?>