*/ require_once '../init.php'; /* * Specify whether we retrieve the contact record by its e-mail (emailaddress1) or ID * * NOTICE. For retrieval by e-mail to work, you should first create an entity key for Contact entity * where [emailaddress1] would be a key attribute. * * It is possible to get all entity keys for given entity from its metadata ($entity->metadata()->keys) */ $isRetrievedByEmail = false; if ($argc > 1) { $contactKeyValue = $argv[1]; if (filter_var($contactKeyValue, FILTER_VALIDATE_EMAIL)) { $isRetrievedByEmail = true; } elseif (Client::isGuid($contactKeyValue)) { $isRetrievedByEmail = false; } else { die('Error: invalid Contact ID or e-mail specified.' . PHP_EOL); } } else { die('Error: Contact ID or e-mail not specified.' . PHP_EOL); } $clientOptions = (include 'config.php'); $clientSettings = new Settings($clientOptions); $client = new Client($clientSettings); $metadata = MetadataCollection::instance($client); echo 'Retrieving contact information for ' . ($isRetrievedByEmail ? 'e-mail' : 'ID') . ' ' . $contactKeyValue . PHP_EOL; $contactKey = null; if ($isRetrievedByEmail) { $contactKey = new \AlexaCRM\CRMToolkit\KeyAttributes();