This repository has been archived by the owner on Jan 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 141
/
sample-clickevent.php
executable file
·77 lines (63 loc) · 3.08 KB
/
sample-clickevent.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
<?php
include_once('tests/UnitBootstrap.php');
use FuelSdk\ET_Client;
use FuelSdk\ET_ClickEvent;
try {
$myclient = new ET_Client();
// Modify the date below to reduce the number of results returned from the request
// Setting this too far in the past could result in a very large response size
$retrieveDate = "2012-01-15T13:00:00.000";
// Retrieve Filtered ClickEvent with GetMoreResults
print "Retrieve Filtered ClickEvent with GetMoreResults \n";
$getClickEvent = new ET_ClickEvent();
$getClickEvent->authStub = $myclient;
$getClickEvent->props = array("SendID","SubscriberKey","EventDate","Client.ID","EventType","BatchID","TriggeredSendDefinitionObjectID","PartnerKey");
$getClickEvent->filter = array('Property' => 'EventDate','SimpleOperator' => 'greaterThan','DateValue' => $retrieveDate);
$getClickEvent->getSinceLastBatch = false;
$getResponse = $getClickEvent->get();
print_r('Get Status: '.($getResponse->status ? 'true' : 'false')."\n");
print 'Code: '.$getResponse->code."\n";
print 'Message: '.$getResponse->message."\n";
print_r('More Results: '.($getResponse->moreResults ? 'true' : 'false')."\n");
print 'Results Length: '. count($getResponse->results)."\n";
print "\n---------------\n";
while ($getResponse->moreResults) {
print "Continue Retrieve All ClickEvent with GetMoreResults \n";
$getResponse = $getClickEvent->GetMoreResults();
print_r('Get Status: '.($getResponse->status ? 'true' : 'false')."\n");
print 'Code: '.$getResponse->code."\n";
print 'Message: '.$getResponse->message."\n";
print_r('More Results: '.($getResponse->moreResults ? 'true' : 'false')."\n");
print 'Results Length: '. count($getResponse->results)."\n";
print "\n---------------\n";
}
// The following request could potentially bring back large amounts of data if run against a production account
/*
// Retrieve All ClickEvent with GetMoreResults
print "Retrieve All ClickEvent with GetMoreResults \n";
$getClickEvent = new ET_ClickEvent();
$getClickEvent->authStub = $myclient;
$getClickEvent->props = array("SendID","SubscriberKey","EventDate","Client.ID","EventType","BatchID","TriggeredSendDefinitionObjectID","PartnerKey");
$getResponse = $getClickEvent->get();
print_r('Get Status: '.($getResponse->status ? 'true' : 'false')."\n");
print 'Code: '.$getResponse->code."\n";
print 'Message: '.$getResponse->message."\n";
print_r('More Results: '.($getResponse->moreResults ? 'true' : 'false')."\n");
print 'Results Length: '. count($getResponse->results)."\n";
print "\n---------------\n";
while ($getResponse->moreResults) {
print "Continue Retrieve All ClickEvent with GetMoreResults \n";
$getResponse = $getClickEvent->GetMoreResults();
print_r('Get Status: '.($getResponse->status ? 'true' : 'false')."\n");
print 'Code: '.$getResponse->code."\n";
print 'Message: '.$getResponse->message."\n";
print_r('More Results: '.($getResponse->moreResults ? 'true' : 'false')."\n");
print 'Results Length: '. count($getResponse->results)."\n";
print "\n---------------\n";
}
*/
}
catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
?>