I'm planning to create lists and add user details as subscribers to them using the exacttarget SOAP API in PHP. The code api has sample code on creating a list. I built my custom logic based on it as follows
public function createList($siteId, $siteDescription){
try {
$list = new ExactTarget_List();
// $list->Description = "PHP Created List"; // List for the venue
// $list->ListName = "PHP API Created List"; // Description about the list
$list->Description = $siteDescription; // List for the venue
$list->ListName = $siteId;
$object = new SoapVar($list, SOAP_ENC_OBJECT, 'List', "http://exacttarget.com/wsdl/partnerAPI");
$request = new ExactTarget_CreateRequest();
$request->Options = NULL;
$request->Objects = array($object);
$results = $client->Create($request);
if ($results->OverallStatus == 'OK')
{
echo 'SUCCESS';
}
else
{
echo 'FAILED';
}
}
catch (SoapFault $e) {
// var_dump(e);
$this->success = 0;
}
}
But my workflow is such that in case list already exists I should proceed to next step of adding subscribers (doh!) to it else create the list first and add subscribers. I could not find any example code snippet on checking if the list exists or not using the code API doc and hence am wondering if this is possible at all. My meager understanding of SOAP and XML is playing big time here and hence requesting if any veterans who have better knowledge or idea on this share some details on it to aid my cause.