-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexamples.php
More file actions
138 lines (111 loc) · 3.33 KB
/
examples.php
File metadata and controls
138 lines (111 loc) · 3.33 KB
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
<?php
use classes\marketing\FacebookAddsClient;
use classes\marketing\FacebookAudienceClient;
use classes\marketing\FacebookInsightsClient;
use classes\marketing\FacebookLeadsClient;
echo 'This is just example!';
die();
require 'vendor/autoload.php';
spl_autoload_register(function ($class_name) {
include $class_name . '.php';
});
/*
* ##########################
* ### FacebookAddsClient ###
* ##########################
*/
$apiClient = new FacebookAddsClient();
// Create Campaign
$campaignName = 'Campaign ' . date('Y-m-d H:i:s');
$apiClient->createCampaign($campaignName);
// Search Targeting
$interest = 'baseball';
$results = $apiClient->searchTargeting($interest);
$apiClient->printArray($results);
// Create AddSet
$campaignId = '23842599771070253';
$results = $apiClient->createAddSet($campaignId);
$apiClient->printArray($results);
// Create Creative
$results = $apiClient->addCreative();
$apiClient->printArray($results);
// Create Creative
$results = $apiClient->createAdd();
$apiClient->printArray($results);
/*
* ##########################
* ### FacebookAuediencesClient ###
* ##########################
*/
$apiClient = new FacebookAudienceClient();
// Create Audience
$name = 'My new CA';
$description = 'People who bought from my website';
$results = $apiClient->createAudience($name, $description);
$apiClient->printArray($results);
// Add users
$audienceId = '23842599816460253';
$emails = [
'antonshell@yandex.ru',
'village@inbox.ru',
];
$results = $apiClient->addPeople($audienceId,$emails);
$apiClient->printArray($results);
// Remove users
$audienceId = '23842599816460253';
$emails = [
'antonshell@yandex.ru',
'village@inbox.ru',
];
$results = $apiClient->addPeople($audienceId,$emails);
$apiClient->printArray($results);
/*
* ###############################
* ### FacebookInsightsClient ###
* ##############################
*
*/
$apiClient = new FacebookInsightsClient();
// Get Campaign Insights
$campaignId = '23842599771070253';
$results = $apiClient->getCampaignInsights($campaignId);
$apiClient->printArray($results);
/*
* ###############################
* ### FacebookLeadsClient ###
* ##############################
*
*/
$apiClient = new FacebookLeadsClient();
// Get Lead Forms
$pageId = '372524659830426';
$results = $apiClient->getLeadgenForms($pageId);
$apiClient->printArray($results);
// Get form leads
$formId = '110805266268975';
$results = $apiClient->getLeads($formId);
$apiClient->printArray($results);
// Check Page Subscription
$pageId = '372524659830426';
$results = $apiClient->checkSubscription($pageId);
$apiClient->printArray($results);
// Subscribe to page Webhooks
$pageId = '372524659830426';
$results = $apiClient->subscribeToPageWebhooks($pageId);
$apiClient->printArray($results);
// Create Legal Content
$pageId = '372524659830426';
$results = $apiClient->createLegalContent($pageId);
$apiClient->printArray($results);
// Create Context Card
$pageId = '372524659830426';
$results = $apiClient->createContextCard($pageId);
$apiClient->printArray($results);
// Create Leadgen Form
$pageId = '372524659830426';
$legalContentId = '344540259314932';
$contextCardId = '1920764724831390';
$formName = 'LeadAds Form Name';
$actionUrl = 'https://www.9round.com/';
$results = $apiClient->createLeadgenForm($pageId,$legalContentId,$contextCardId,$formName,$actionUrl);
$apiClient->printArray($results);