Php Flow » Php

create subscription list

  1. <?php  
  2.     echo ‘<pre>’;  
  3. echo $path = $_SERVER['DOCUMENT_ROOT'].‘tests/tested/00 Includes/’;  
  4. require($path . ‘exacttarget_soap_client.php’);  
  5.   
  6. $wsdl = ‘https://webservice.s4.exacttarget.com/etframework.wsdl’;  
  7. try{  
  8.   
  9. /* Create the Soap Client */  
  10. $client = new ExactTargetSoapClient($wsdlarray(‘trace’=>1));  
  11.   
  12. /* Set username and password here */  
  13. $client->username = ‘xxx’;  
  14. $client->password = ‘xxx’;  
  15.   
  16.  $list = new ExactTarget_List();  
  17.             $list->Description = “PHP List1″;  
  18.             $list->ListName = “Test List1″;  
  19.   
  20.             $object = new SoapVar($list, SOAP_ENC_OBJECT, ‘List’“http://exacttarget.com/wsdl/partnerAPI”);  
  21.   
  22.             $request = new ExactTarget_CreateRequest();  
  23.             $request->Options = NULL;  
  24.             $request->Objects = array($object);  
  25.   
  26.             $results = $client->Create($request);  
  27.   
  28.         if ($results->OverallStatus == ‘OK’)   
  29.         {  
  30.         echo ‘SUCCESS’;  
  31.         print_r($results->Results->NewID);  
  32.         //print_r($results->NewID);  
  33.         }  
  34.         else  
  35.         {  
  36.         echo ‘FAILED’;  
  37.         }  
  38.   
  39. } catch (SoapFault $e) {  
  40.   
  41.     /* output the resulting SoapFault upon an error */  
  42.     var_dump($e);  
  43. }  
  44.     echo ‘</pre>’;  
  45. ?>  

Did you enjoy this article? Share it!

About the Author:

Hi, This is Parvez Alam from India. I am software developer with 4 years’ experience in web development. I have submitted articles on PHP, Mysql, Magento,CSS, HTML, jQuery, web designing and social API. You can subscribe to my blog via RSS/Twitter/Google plus and Facebook. parvez1487(at)gmail(dot)com

Random Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>