Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $first_name = $last_name = '';
- $name_details = explode(" ", $Name);
- if (isset($name_details[0])) {
- $first_name = $name_details[0];
- }
- if (isset($name_details[1])) {
- $$last_name = $name_details[1];
- }
- /* Create the Soap Client */
- @$client = new ExactTargetSoapClient($this->wsdl, array('trace'=>1));
- /* Set username and password here */
- $client->username = SOAP_USER;
- $client->password = SOAP_PASSWORD;
- $ts = new ExactTarget_TriggeredSend();
- $tsd = new ExactTarget_TriggeredSendDefinition();
- $tsd->CustomerKey = "e-Gift";
- $FirstName = new ExactTarget_Attribute();
- $FirstName->Name = "First_name";
- $FirstName->Value = $first_name;
- $LastName = new ExactTarget_Attribute();
- $LastName->Name = "Last_name";
- $LastName->Value = $last_name;
- $GiftMessage = new ExactTarget_Attribute();
- $GiftMessage->Name = "GiftPersonalMessage";
- $GiftMessage->Value = $Message;
- $sub = new ExactTarget_Subscriber();
- $sub->EmailAddress = $Email;
- $sub->SubscriberKey = $Email;
- //$sub->Attributes = array($UserName);
- $tsd->Attributes = array($FirstName, $LastName,$GiftMessage);
- $ts->Subscribers = array();
- $ts->Subscribers = $sub;
- $ts->TriggeredSendDefinition = $tsd;
- $object = new SoapVar($ts, SOAP_ENC_OBJECT, 'TriggeredSend', "http://exacttarget.com/wsdl/partnerAPI");
- echo '<pre>';
- //print_r($object);
- echo '</pre>';
- echo "<br><br>";
- $request = new ExactTarget_CreateRequest();
- $request->Options = null;
- $request->Objects = array($object);
- $results = $client->Create($request);
- $first_name = $last_name = '';
- $name_details = explode(" ", $Name);
- if (isset($name_details[0])) {
- $first_name = $name_details[0];
- }
- if (isset($name_details[1])) {
- $last_name = $name_details[1];
- }
- /* Create the Soap Client */
- $client = new ExactTargetSoapClient($this->wsdl, array('trace'=>1));
- /* Set username and password here */
- $client->username = SOAP_USER;
- $client->password = SOAP_PASSWORD;
- $schr = new ExactTarget_ScheduleRequestMsg();
- $schr->Action = "start";
- $schr->Interactions = array();
- $DateTimeString = date(DATE_ATOM, strtotime($datetime));
- $SendTime = new DateTime($DateTimeString);
- $SendTime->setTimezone(new DateTimeZone('UTC'));
- $etr = new ExactTarget_DailyRecurrence();
- $etr->DailyRecurrencePatternType = ExactTarget_DailyRecurrencePatternTypeEnum::Interval;
- $etr->DayInterval = 1;
- $senddeflist = new ExactTarget_SendDefinitionList();
- $senddeflist->DataSourceTypeID = "List";
- $emailobj = new ExactTarget_Email();
- $emailobj->ID = $emailId;
- $esd = new ExactTarget_EmailSendDefinition();
- $esd->SendDefinitionList = $senddeflist;
- $esd->Email = $emailobj;
- $esd->First_name = $first_name;
- $esd->Last_name = $last_name;
- //$esd->SendClassification = $sendclass;
- $esd->CustomerKey = 'e-Gift';
- /*$sub = new ExactTarget_Subscriber();
- $sub->EmailAddress = $Email;
- $sub->SubscriberKey = $Email;
- $esd->Subscribers = array();
- $esd->Subscribers = $sub;
- $esd->TriggeredSendDefinition = $tsd;*/
- $sd = new ExactTarget_ScheduleDefinition();
- $sd->RecurrenceType = ExactTarget_RecurrenceTypeEnum::Daily;
- $sd->RecurrenceRangeType = ExactTarget_RecurrenceRangeTypeEnum::EndAfter;
- $sd->StartDateTime = $SendTime->format("c");
- $sd->Occurrences = 1;
- $sd->Recurrence = new SoapVar($etr, SOAP_ENC_OBJECT, 'DailyRecurrence', 'http://exacttarget.com/wsdl/partnerAPI');
- $schr->Schedule = $sd;
- //$sendclass = new ExactTarget_SendClassification();
- //$sendclass->CustomerKey = $customerKey;
- $schr->Interactions[] = new SoapVar($esd, SOAP_ENC_OBJECT, 'EmailSendDefinition', 'http://exacttarget.com/wsdl/partnerAPI');
- $schr->Options = null;
- echo '<pre>';
- //print_r($schr);
- echo '</pre>';
- $results = $client->Schedule($schr);
- echo '<pre>';
- //print_r($results);
- echo '</pre>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement