-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsklik_tutorial.php
44 lines (35 loc) · 1 KB
/
sklik_tutorial.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
<?php
// Sklik username
$sklikUserName = "";
// Sklik password
$sklikPassword = "";
// True to debug using sandbox instead of production API
$useSandbox = false;
include 'xmlrpc.inc'; // ! Fixed XMLRPC lib
include 'sklik.inc'; // Sklik lib
try {
$sklik = new Sklik($sklikUserName, $sklikPassword, $userSandbox);
// Retrieve my account information
$res = $sklik->client->get();
print_r($res);
// Retrieve statistics of campaigns
$res = $sklik->campaigns->stats(
array(590451, 590451),
array(
"dateFrom" => Sklik::dateTime(mktime(0, 0, 0, 1, 1, 2012)),
"dateTo" => Sklik::dateTime(mktime(0, 0, 0, 1, 31, 2012)),
"granularity" => "daily",
"includeFulltext" => true,
"includeContext" => true
)
);
print_r($res);
// Manage foreign accounts
$sklik->setUserId(123456);
$res = $sklik->campaigns->list();
print_r($res);
// If method call fails
} catch (MethodError $e) {
echo $e; // Returns error description including traceback
print_r($e->getResponse()); // Result returned from Sklik API
}