Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', My_Sendinblue::API_KEY);
- $api_instance = new SendinBlue\Client\Api\ContactsApi();
- $created_at = new Zend_Date($this->created_at);
- $updated_at = new Zend_Date($this->updated_at);
- $attributes = array(
- 'USERNAME' => $this->username,
- 'COACH' => $this->coach,
- 'SKYPE' => $this->skype,
- 'FIRSTNAME' => $this->firstname,
- 'LASTNAME' => $this->lastname,
- 'BIRTHDAY' => $this->birthday,
- 'CREATED_AT' => $created_at->toString('yyyy-MM-dd'),
- 'UPDATED_AT' => $updated_at->toString('yyyy-MM-dd'),
- );
- try {
- $result = $api_instance->getContactInfo($this->email);
- $updateContact = new \SendinBlue\Client\Model\UpdateContact();
- $updateContact->setAttributes($attributes);
- try {
- $api_instance->updateContact($this->email, $updateContact);
- } catch (Exception $e) {
- echo 'Exception when calling ContactsApi->updateContact: ', $e->getMessage(), PHP_EOL;
- }
- } catch (Exception $e) {
- echo 'Exception when calling ContactsApi->getContactInfo: ', $e->getMessage(), PHP_EOL;
- $createContact = new \SendinBlue\Client\Model\CreateContact();
- $createContact->setEmail($this->email);
- $createContact->setAttributes($attributes);
- try {
- $result = $api_instance->createContact($createContact);
- } catch (Exception $e) {
- echo 'Exception when calling ContactsApi->createContact: ', $e->getMessage(), PHP_EOL;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement