Created
February 10, 2017 23:02
-
-
Save tpatch/dfe01f28c8a17611ed0976ad02631bdd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('ET_Client.php'); | |
$myclient = new \ET_Client(); | |
// NOTE: These examples only work in accounts where the SubscriberKey functionality is not enabled | |
// SubscriberKey will need to be included in the props if that feature is enabled | |
// Create Subscriber | |
$subCreate = new \ET_Subscriber(); | |
$subCreate->authStub = $myclient; | |
$subCreate->props = array("EmailAddress" => $email, "Lists" => array("ID" => $listId)); | |
$subCreate->props['Attributes'] = array(array('Name' => 'First Name', 'Value' => $firstName), array('Name' => 'Last Name', 'Value' => $lastName), array('Name' => 'Full Name', 'Value' => $fullName)); | |
$postResult = $subCreate->post(); | |
if ($postResult->status){ | |
$sendTrigger = new \ET_TriggeredSend(); | |
$sendTrigger->props = array('CustomerKey' => '0000'); | |
$sendTrigger->authStub = $myclient; | |
$sendTrigger->subscribers = array(array("EmailAddress" => $email, "SubscriberKey" => $email)); | |
$sendResult = $sendTrigger->send(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment