Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Take A QuizChallenge yourself and boost your learning! Start the quiz now to earn credits.
Take A QuizUnlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
Take A QuizKindly log in to use this feature. We’ll take you to the login page automatically.
LoginGeneral Tech Bugs & Fixes 3 years ago
User submissions are the sole responsibility of contributors, with TuteeHUB disclaiming liability for accuracy, copyrights, or consequences of use; content is for informational purposes only and not professional advice.
No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
Kindly log in to use this feature. We’ll take you to the login page automatically.
LoginReady to take your education and career to the next level? Register today and join our growing community of learners and professionals.
Your experience on this site will be improved by allowing cookies. Read Cookie Policy
Your experience on this site will be improved by allowing cookies. Read Cookie Policy
manpreet
Best Answer
3 years ago
I am trying to create a triggered send using the API with PHP.
The soap call is registering, however, i don't believe the function is registering correctly. I have a Triggered Send Definition already set up in the account and a DE associated with it.
verification if statement is :
if (preg_match("/^([a-z]+[\w-]*\.?)+@([\w-]+\.)+[a-z]{2,4}$/i", $_POST['email'])) { date_default_timezone_set('UTC'); $dateTime = new DateTime (); $setDateVal = date('n/j/Y',strtotime('now')); $email = $_POST['email']; $zip = $_POST['zip']; include('exacttarget_soap_client.php'); $wsdl = 'https://webservice.s4.exacttarget.com/etframework.wsdl'; try { /* Create the Soap Client */ $client = new ExactTargetSoapClient($wsdl, array('trace' => 1)); /* Set username and password * * here */ $client->username = '************'; $client->password = '************'; $subscriber = new ExactTarget_Subscriber(); $subscriber->EmailAddress = $email; $subscriber->SubscriberKey = $email; // This section is needed if you are adding a subscriber to a Lock and Publish account using an enterprise API user $cl = new ExactTarget_APIObject(); $cl->ID = **********; $cl->CustomerKey = '**********'; $subscriber->Client = $cl; //% ExactTarget_Subscriber $attribute1 = new ExactTarget_Attribute(); $attribute1->Name = "POSTALCODE"; $attribute1->Value = $zip; //% ExactTarget_Subscriber $attribute3 = new ExactTarget_Attribute(); $attribute3->Name = "DATE"; $attribute3->Value = $setDateVal; //% ExactTarget_Subscriber $attribute4 = new ExactTarget_Attribute(); $attribute4->Name = "OPTIN"; $attribute4->Value = "Y"; $subscriber->Attributes = array($attribute1, $attribute2, $attribute3, $attribute4); // This is the section needed to define it as an "Upsert" $so = new ExactTarget_SaveOption(); $so->PropertyName = "*"; $so->SaveAction = ExactTarget_SaveAction::UpdateAdd; $soe = new SoapVar($so, SOAP_ENC_OBJECT, 'SaveOption', "http://exacttarget.com/wsdl/partnerAPI"); $opts = new ExactTarget_UpdateOptions(); $opts->SaveOptions = array($soe); $object = new SoapVar($subscriber, SOAP_ENC_OBJECT, 'Subscriber', "http://exacttarget.com/wsdl/partnerAPI"); $request = new ExactTarget_CreateRequest(); $request->Options = $opts; $request->Objects = array($object); $results = $client->Create($request); print_r($results); } catch (SoapFault $e) { print_r($e->faultstring); } }Am I using the correct code? Is there a TriggeredSend Shell available for PHP, and if so - where do i define subscriber/DE attributes?