コード例 #1
0
<?php

require '../ET_Client.php';
try {
    $myclient = new ET_Client();
    $NewListName = "PHPSDKList";
    $subs = array();
    $subs[] = array("EmailAddress" => "*****@*****.**", "Attributes" => array(array("Name" => "First Name", "Value" => "Mac"), array("Name" => "List Name", "Value" => "Testing")));
    $subs[] = array("EmailAddress" => "*****@*****.**", "Attributes" => array(array("Name" => "First Name", "Value" => "Mac"), array("Name" => "List Name", "Value" => "Testing")));
    // Example using AddSubscribersToLists() method
    // Typically this method will be used with a pre-existing list but for testing purposes one is being created.
    // Create List
    print "Create List \n";
    $postContent = new ET_List();
    $postContent->authStub = $myclient;
    $postContent->props = array("ListName" => $NewListName, "Description" => "This list was created with the PHPSDK", "Type" => "Private");
    $postResponse = $postContent->post();
    print_r('Post Status: ' . ($postResponse->status ? 'true' : 'false') . "\n");
    print 'Code: ' . $postResponse->code . "\n";
    print 'Message: ' . $postResponse->message . "\n";
    print 'Results Length: ' . count($postResponse->results) . "\n";
    print 'Results: ' . "\n";
    print_r($postResponse->results);
    print "\n---------------\n";
    if ($postResponse->status) {
        $newListID = $postResponse->results[0]->NewID;
        // Adding Multiple Subscribers To a List in Bulk
        print "Adding Multiple Subscribers To a List in Bulk \n";
        $response = $myclient->AddSubscribersToLists($subs, array($newListID));
        print_r('Response Status: ' . ($response->status ? 'true' : 'false') . "\n");
        print 'Code: ' . $response->code . "\n";
コード例 #2
0
<?php

require '../ET_Client.php';
try {
    $myclient = new ET_Client();
    ## Example using CreateContentAreas() method
    $NameOfContentAreaOne = "ExampleContentAreaOne";
    $NameOfContentAreaTwo = "ExampleContentAreaTwo";
    # Declare a Ruby Hash which contain all of the details for a DataExtension
    $contAreaOne = array("CustomerKey" => $NameOfContentAreaOne, "Name" => $NameOfContentAreaOne, "Content" => "<b>Some HTML Content Goes here</b>");
    $contAreaTwo = array("CustomerKey" => $NameOfContentAreaTwo, "Name" => $NameOfContentAreaTwo, "Content" => "<b>Some Different HTML Content Goes here</b>");
    # Call CreateDataExtensions passing in both DataExtension Hashes as an Array
    print_r(">>> Calling CreateContentAreas\n");
    $response = $myclient->CreateContentAreas(array($contAreaOne, $contAreaTwo));
    print_r('Response Status: ' . ($response->status ? 'true' : 'false') . "\n");
    print 'Code: ' . $response->code . "\n";
    print 'Message: ' . $response->message . "\n";
    print 'Result Count: ' . count($response->results) . "\n";
    print 'Results: ' . "\n";
    print_r($response->results);
    print "\n---------------\n";
    print_r(">>> Delete contAreaOne\n");
    $contArea = new ET_ContentArea();
    $contArea->authStub = $myclient;
    $contArea->props = array("CustomerKey" => $NameOfContentAreaOne);
    $delResponse = $contArea->delete();
    print_r('Delete Status: ' . ($delResponse->status ? 'true' : 'false') . "\n");
    print 'Code: ' . $delResponse->code . "\n";
    print 'Message: ' . $delResponse->message . "\n";
    print 'Result Count: ' . count($delResponse->results) . "\n";
    print 'Results: ' . "\n";
コード例 #3
0
<?php

require '../ET_Client.php';
try {
    $myclient = new ET_Client();
    $NameOfAttributeOne = "ExampleAttributeOne";
    $NameOfAttributeTwo = "ExampleAttributeTwo";
    # Declare an array which contain all of the details for a DataExtension
    $profileAttrOne = array("Name" => $NameOfAttributeOne, "PropertyType" => "string", "Description" => "New Attribute from the SDK", "IsRequired" => "false", "IsViewable" => "false", "IsEditable" => "true", "IsSendTime" => "false");
    $profileAttrTwo = array("Name" => $NameOfAttributeTwo, "PropertyType" => "string", "Description" => "New Attribute from the SDK", "IsRequired" => "false", "IsViewable" => "false", "IsEditable" => "true", "IsSendTime" => "false");
    # Call CreateProfileAttributes passing in both Profile Attribute arrays
    print '>>> CreateProfileAttributes';
    $response = $myclient->CreateProfileAttributes(array($profileAttrOne, $profileAttrTwo));
    print_r('CreateProfileAttributes Status: ' . ($response->status ? 'true' : 'false') . "\n");
    print 'Code: ' . $response->code . "\n";
    print 'Message: ' . $response->message . "\n";
    print 'Results Length: ' . count($response->results) . "\n";
    print 'Results: ' . "\n";
    print_r($response->results);
    print "\n---------------\n";
    print '>>> Delete profileAttrOne';
    $profileattr = new ET_ProfileAttribute();
    $profileattr->authStub = $myclient;
    $profileattr->props = array("Name" => $NameOfAttributeOne);
    $delResponse = $profileattr->delete();
    print_r('Delete Status: ' . ($delResponse->status ? 'true' : 'false') . "\n");
    print 'Code: ' . $delResponse->code . "\n";
    print 'Message: ' . $delResponse->message . "\n";
    print 'Results Length: ' . count($delResponse->results) . "\n";
    print 'Results: ' . "\n";
    print_r($delResponse->results);
コード例 #4
0
<?php

require '../ET_Client.php';
try {
    $myclient = new ET_Client();
    $NewListName = "PHPSDKList";
    $EmailAddressesArray = array("*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**");
    // Example using AddSubscriberToList() method
    // Typically this method will be used with a pre-existing list but for testing purposes one is being created.
    // Create List
    print "Create List \n";
    $postContent = new ET_List();
    $postContent->authStub = $myclient;
    $postContent->props = array("ListName" => $NewListName, "Description" => "This list was created with the PHPSDK", "Type" => "Private");
    $postResponse = $postContent->post();
    print_r('Post Status: ' . ($postResponse->status ? 'true' : 'false') . "\n");
    print 'Code: ' . $postResponse->code . "\n";
    print 'Message: ' . $postResponse->message . "\n";
    print 'Results Length: ' . count($postResponse->results) . "\n";
    print 'Results: ' . "\n";
    print_r($postResponse->results);
    print "\n---------------\n";
    if ($postResponse->status) {
        $newListID = $postResponse->results[0]->NewID;
        // Adding Subscriber To a List
        print "Adding Subscriber To a List \n";
        $response = $myclient->AddSubscriberToList("*****@*****.**", array($newListID));
        print_r('Response Status: ' . ($response->status ? 'true' : 'false') . "\n");
        print 'Code: ' . $response->code . "\n";
        print 'Message: ' . $response->message . "\n";
        print 'Results Length: ' . count($response->results) . "\n";
<?php

require '../ET_Client.php';
try {
    $myclient = new ET_Client();
    $DataExtensionCustomerKey = "62476204-bfd3-de11-95ca-001e0bbae8cc";
    $CSVFileName = "SDKExample.csv";
    /*
    Parameters:
    * Data Extension CustomerKey - CustomerKey values are displayed in the UI as External Key   
    * File Name - File must be a CSV located on your ExactTarget FTP Site
    * Overwrite (Boolean) - Set to True in order to overwrite all existing data in the data extension. Required if Data Extension does not have a primary key.
    */
    # Call CreateAndStartDataExtensionImport
    $response = $myclient->CreateAndStartDataExtensionImport($DataExtensionCustomerKey, $CSVFileName, true);
    print_r('Import Status: ' . ($response->status ? 'true' : 'false') . "\n");
    print 'Code: ' . $response->code . "\n";
    print 'Message: ' . $response->message . "\n";
    print 'Results Length: ' . count($response->results) . "\n";
    print 'Results: ' . "\n";
    print_r($response->results);
    print "\n---------------\n";
} catch (Exception $e) {
    echo 'Caught exception: ', $e->getMessage(), "\n";
}
?>



コード例 #6
0
<?php

require '../ET_Client.php';
try {
    $myclient = new ET_Client();
    $EmailIDForSendDefinition = "3113962";
    $ListIDForSendDefinition = "1729515";
    $SendClassificationCustomerKey = "2239";
    # Call SendEmailToList
    $response = $myclient->SendEmailToList($EmailIDForSendDefinition, $ListIDForSendDefinition, $SendClassificationCustomerKey);
    print_r('Send Status: ' . ($response->status ? 'true' : 'false') . "\n");
    print 'Code: ' . $response->code . "\n";
    print 'Message: ' . $response->message . "\n";
    print 'Results Length: ' . count($response->results) . "\n";
    print 'Results: ' . "\n";
    print_r($response->results);
    print "\n---------------\n";
} catch (Exception $e) {
    echo 'Caught exception: ', $e->getMessage(), "\n";
}
?>



コード例 #7
0
<?php

require '../ET_Client.php';
try {
    $myclient = new ET_Client();
    $ListID = "1956035";
    $CSVFileName = "SDKExample.csv";
    /*
    Parameters:
    	List ID  
    	File Name - File must be a CSV located on your ExactTarget FTP Site
    */
    # Call SendEmailToList
    $response = $myclient->CreateAndStartListImport($ListID, $CSVFileName);
    print_r('Import Status: ' . ($response->status ? 'true' : 'false') . "\n");
    print 'Code: ' . $response->code . "\n";
    print 'Message: ' . $response->message . "\n";
    print 'Results Length: ' . count($response->results) . "\n";
    print 'Results: ' . "\n";
    print_r($response->results);
    print "\n---------------\n";
} catch (Exception $e) {
    echo 'Caught exception: ', $e->getMessage(), "\n";
}
?>



コード例 #8
0
<?php

require '../ET_Client.php';
try {
    $myclient = new ET_Client();
    ## Example using CreateDataExtensions() method
    // Declare an associative array which contain all of the details for a DataExtension
    $deOne = array("Name" => "HelperDEOne", "CustomerKey" => "HelperDEOne");
    $deOne['columns'] = array(array("Name" => "Name", "FieldType" => "Text", "IsPrimaryKey" => "true", "MaxLength" => "100", "IsRequired" => "true"), array("Name" => "OtherField", "FieldType" => "Text"));
    // Declare a 2nd array which contain all of the details for a DataExtension
    $deTwo = array("Name" => "HelperDETwo", "CustomerKey" => "HelperDETwo");
    $deTwo['columns'] = array(array("Name" => "Name", "FieldType" => "Text", "IsPrimaryKey" => "true", "MaxLength" => "100", "IsRequired" => "true"), array("Name" => "OtherField", "FieldType" => "Text"));
    // Call CreateDataExtensions passing in both DataExtension arrays
    $response = $myclient->CreateDataExtensions(array($deOne, $deTwo));
    print_r('Response Status: ' . ($response->status ? 'true' : 'false') . "\n");
    print 'Code: ' . $response->code . "\n";
    print 'Message: ' . $response->message . "\n";
    print 'Results Length: ' . count($response->results) . "\n";
    print "Results: \n";
    print_r($response->results);
    print "\n---------------\n";
    // Delete deOne
    print_r("Delete deOne  \n");
    $deleteDE = new ET_DataExtension();
    $deleteDE->authStub = $myclient;
    $deleteDE->props = array("CustomerKey" => "HelperDEOne");
    $deleteResult = $deleteDE->delete();
    print_r('Delete Status: ' . ($deleteResult->status ? 'true' : 'false') . "\n");
    print 'Code: ' . $deleteResult->code . "\n";
    print 'Message: ' . $deleteResult->message . "\n";
    print 'Result Count: ' . count($deleteResult->results) . "\n";
コード例 #9
0
<?php

require '../ET_Client.php';
try {
    $myclient = new ET_Client();
    $EmailIDForSendDefinition = "3113962";
    $SendClassificationCustomerKey = "2239";
    $SendableDataExtensionCustomerKey = "F6F3871A-D124-499B-BBF5-3EFC0E827A51";
    # Call SendEmailToList
    $response = $myclient->SendEmailToDataExtension($EmailIDForSendDefinition, $SendableDataExtensionCustomerKey, $SendClassificationCustomerKey);
    print_r('Send Status: ' . ($response->status ? 'true' : 'false') . "\n");
    print 'Code: ' . $response->code . "\n";
    print 'Message: ' . $response->message . "\n";
    print 'Results Length: ' . count($response->results) . "\n";
    print 'Results: ' . "\n";
    print_r($response->results);
    print "\n---------------\n";
} catch (Exception $e) {
    echo 'Caught exception: ', $e->getMessage(), "\n";
}
?>