· 6 years ago · Aug 30, 2019, 06:44 AM
1public function add_client($campaign_id = 'M')
2 {
3 $client = GetresponseClientFactory::createWithApiKey(GR_API_KEY);
4 $campaignsOperation = new GetCampaigns();
5 $response = $client->call($campaignsOperation);
6
7 if ($response->isSuccess()) {
8 $newContact = new NewContact(
9 new CampaignReference($campaign_id),
10 'test' . uniqid() . '@gmail.com'
11 );
12
13 $createContact = new CreateContact($newContact);
14
15 $response = $client->call($createContact);
16 }
17 }