Advertisement
Guest User

Untitled

a guest
Jul 4th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. $attributes = array(
  2. 'Double_Opt_in' => true,
  3. 'Double_Opt_in_Date' => date('d.m.Y h:m'),
  4. 'Double_Opt_in_IP' => $_SERVER['REMOTE_ADDR'],
  5. 'Checkin_opt_in' => true,
  6. 'Country_Code' => '',
  7. 'Language' => ''
  8. );
  9. $client = new ExactTargetSoapClient("$wsdl", array('trace' => 1));
  10. $client->username = "$username";
  11. $client->password = "$password";
  12.  
  13. $subscriber = new ExactTarget_Subscriber();
  14. $subscriber->EmailAddress = $email;
  15. $subscriber->SubscriberKey = $email;
  16.  
  17. $Double_Opt_in = new ExactTarget_Attribute();
  18. $Double_Opt_in->Name = "Double_Opt_in";
  19. $Double_Opt_in->Value = 'true';
  20.  
  21. $Double_Opt_in_Date = new ExactTarget_Attribute();
  22. $Double_Opt_in_Date->Name = "Double_Opt_in_Date";
  23. $Double_Opt_in_Date->Value = date('m.d.Y h:i');
  24.  
  25. $Double_Opt_in_IP = new ExactTarget_Attribute();
  26. $Double_Opt_in_IP->Name = "Double_Opt_in_IP";
  27. $Double_Opt_in_IP->Value = $_SERVER['REMOTE_ADDR'];
  28.  
  29. $subscriber->Attributes = array(
  30. $Double_Opt_in,
  31. $Double_Opt_in_Date,
  32. $Double_Opt_in_IP,
  33. );
  34. $subscriber->Lists = array();
  35. $list->ID = "123456";
  36. $subscriber->Lists[] = $list;
  37.  
  38. $so = new ExactTarget_SaveOption();
  39. $so->PropertyName = "*";
  40. $so->SaveAction = ExactTarget_SaveAction::UpdateAdd;
  41. $soe = new SoapVar($so, SOAP_ENC_OBJECT, 'SaveOption', "http://exacttarget.com/wsdl/partnerAPI");
  42. $opts = new ExactTarget_UpdateOptions();
  43. $opts->SaveOptions = array($soe);
  44.  
  45. $object = new SoapVar($subscriber, SOAP_ENC_OBJECT, 'Subscriber', "http://exacttarget.com/wsdl/partnerAPI");
  46.  
  47. $request = new ExactTarget_CreateRequest();
  48. $request->Options = $opts;
  49. $request->Objects = array($object);
  50.  
  51. $results = $client->Create($request);
  52. write_log($results);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement