<?php

include '../bootstrap.php';
$instance = new interact();
// print out the XML of the requests and responses!
$instance->debug = true;
$instance->intitializeSoapClient($config_file['location']['wsdl'], $config_file['location']['endpoint']);
if ($instance->login($config_file['auth_regular']['login'], $config_file['auth_regular']['pass'])) {
    $table_object = new InteractObject();
    $table_object->setFolderName("Mason");
    $table_object->setObjectName("temp_supp_table");
    $fields = array('EMAIL_ADDRESS', 'AGE', 'CITY', 'DATE_MASON');
    $record_data = array('*****@*****.**', 'somestring', 'SanBruno', '2014-08-25T02:00:00.000-08:00');
    $record = new Record();
    $record->setFieldValues($record_data);
    $merge_table_obj = new mergeTableRecordsWithPK();
    $merge_table_obj->setInsertOnNoMatchParam(true);
    $merge_table_obj->setUpdateOnMatch(UpdateOnMatch::REPLACE);
    $merge_table_obj->setTableParam($table_object);
    $records[] = $record;
    $recordData = new RecordData();
    $recordData->setFieldNames($fields);
    $recordData->setRecords($records);
    $merge_table_obj->setRecordDataParam($recordData);
    print_r($merge_table_obj);
    $response = $instance->execute($merge_table_obj);
    $instance->logout();
}
<?php

include '../bootstrap.php';
try {
    $instance = new interact();
    $instance->debug = true;
    $instance->intitializeSoapClient($config_file['location']['wsdl'], $config_file['location']['endpoint']);
    if ($instance->login($config_file['auth_regular']['login'], $config_file['auth_regular']['pass'])) {
        $retrieve_obj = new retrieveListMembers();
        $int_obj = new InteractObject();
        $int_obj->setFolderName("Mason");
        $int_obj->setObjectName("masonList1");
        $retrieve_obj->setFieldListParam(array("RIID_", "EMAIL_ADDRESS_", "FIRST_NAME"));
        $retrieve_obj->setIdsToRetrieve(array("*****@*****.**"));
        $retrieve_obj->setListParam($int_obj);
        $retrieve_obj->setQueryColumn(QueryColumn::EMAIL2);
        $results = $instance->execute($retrieve_obj);
        // do something with results?
        print_r($results);
        $instance->logout();
    } else {
        die("Login failed, no reason to go on...");
    }
} catch (SoapFault $fault) {
    print_r($fault);
} catch (Exception $exception) {
    print_r($exception);
}
 $reject_channel = new RejectChannel();
 $reject_channel->rejectChannel = $reject_channel::EMAIL;
 $rule->setRejectChannel($reject_channel);
 $update = new UpdateOnMatch();
 $update->updateOnMatch = $update::REPLACE;
 $rule->setUpdateOnMatch($update);
 $merge_obj->setMergeRuleParam($rule);
 $fieldNames = array("EMAIL_ADDRESS_", "CUSTOMER_ID_");
 $record_1 = new Record();
 $record_1->setFieldValues(array("*****@*****.**", "TEST_MDIXON"));
 $record_2 = new Record();
 $record_2->setFieldValues(array("*****@*****.**", "TEST_MDIXON"));
 $records[] = $record_1;
 $records[] = $record_2;
 $merge_obj->setRecordDataParam($fieldNames, $records);
 $merge_result_ids = $instance->execute($merge_obj);
 /*
  * merge call end
  */
 /*
  * trigger event call begin
  */
 $custom_obj = new triggerCustomEvent();
 $custom_event = new CustomEvent();
 $custom_event->setEventName("DEV_SUPP_TEST");
 $custom_obj->setCustomEventParam($custom_event);
 $identifier = new RecipientIdentifier();
 $identifier->setValue(RecipientIdentifier::RECIPIENT_ID);
 /*
  * Transient data is optionalData in Responsys Jargon
  * These name value pairs can be used to display in the 
 $rule->setDefaultPermissionStatus($status);
 $rule->setInsertOnNoMatch(true);
 $rule->setMatchColumn1($match1);
 $rule->setMatchOperator($match_op);
 $rule->setRejectChannel($reject_channel);
 $rule->setUpdateOnMatch($update);
 $merge_obj->setMergeRuleParam($rule);
 $fieldNames = array("EMAIL_ADDRESS_", "EMAIL_PERMISSION_STATUS_", "CITY_");
 $record_1 = new Record();
 $record_1->setFieldValues(array("*****@*****.**", "I", "optin city"));
 $record_2 = new Record();
 $record_2->setFieldValues(array("*****@*****.**", "O", "optout city"));
 $records[] = $record_1;
 $records[] = $record_2;
 $merge_obj->setRecordDataParam($fieldNames, $records);
 $merge_result_ids = $instance->execute($merge_obj);
 // Now we make a secondary merge call to opt out the newly inserted record....
 // for brevity i will reuse some of the variables above
 /*
 $fieldNames2 = array( "EMAIL_ADDRESS_", "EMAIL_PERMISSION_STATUS_", "CITY_" );
 
 $record_2 = new Record();
 $record_2->setFieldValues( array( "*****@*****.**", "OPTOUT") );
 $records2[] = $record_2;
 
 $merge_obj->setRecordDataParam( $fieldNames2, $records2 );
 $merge_result_ids_2 = $instance->execute( $merge_obj );
 */
 // Now lets use retrieveListMembers to confirm that the change took place
 // The email permission status should be "O" which is optout
 $retrieve_obj = new retrieveListMembers();
<?php

include '../bootstrap.php';
try {
    $instance = new interact();
    $instance->debug == true;
    $instance->intitializeSoapClient('https://ws2.responsys.net/webservices/wsdl/ResponsysWS_Level1.wsdl', 'https://ws2.responsys.net/webservices/services/ResponsysWSService');
    if ($instance->login('masonTest', 'XixXcbF30j')) {
        $listFolders_object = new listFolders();
        $listFolders_result = $instance->execute($listFolders_object);
        foreach ($listFolders_result->result as $folder) {
            echo $folder->name . "\n";
        }
        $instance->logout();
    } else {
        die("Login failed, no reason to go on...");
    }
} catch (SoapFault $fault) {
    print_r($fault);
} catch (Exception $exception) {
    print_r($exception);
}
<?php

include '../bootstrap.php';
$instance = new interact();
// print out the XML of the requests and responses!
$instance->debug = true;
$instance->intitializeSoapClient($config_file['location']['wsdl'], $config_file['location']['endpoint']);
if ($instance->login($config_file['auth_regular']['login'], $config_file['auth_regular']['pass'])) {
    $table_object = new InteractObject();
    $table_object->setFolderName("Mason");
    $table_object->setObjectName("temp_supp_table");
    $field_details = array(array('fieldName' => 'Email_address', 'fieldType' => 'STR500', 'custom' => false, 'dataExtractionKey' => true), array('fieldName' => 'age', 'fieldType' => 'STR500', 'custom' => false, 'dataExtractionKey' => false), array('fieldName' => 'city', 'fieldType' => 'STR500', 'custom' => false, 'dataExtractionKey' => false));
    $primary_keys = array('Email_address');
    $create_table_obj = new createTableWithPK();
    $create_table_obj->setFieldsParam($field_details);
    $create_table_obj->setPrimaryKeysParam($primary_keys);
    $create_table_obj->setTableParam($table_object);
    $response = $instance->execute($create_table_obj);
    $instance->logout();
}
        $values[] = array("*****@*****.**", "mike");
        $values[] = array("*****@*****.**", "tony");
        foreach ($values as $array) {
            $record = new Record();
            $record->setFieldValues($array);
            $records[] = $record;
        }
        $transientDataArray[] = array("FIRSTNAME" => "Mason");
        $transientDataArray[] = array("FIRSTNAME" => "Sam");
        for ($tmp = 0; $tmp < count($transientDataArray); $tmp++) {
            $optionalDataArray = null;
            foreach ($transientDataArray[$tmp] as $name => $value) {
                $optionalData = new optionalData();
                $optionalData->name = $name;
                $optionalData->value = $value;
                $optionalDataArray[] = $optionalData;
            }
            $triggerDataArray[] = $optionalDataArray;
        }
        $merge_trigger_obj->setRecordDataParam($fields, $values);
        $merge_trigger_obj->setTriggerDataParam($triggerDataArray);
        $result = $instance->execute($merge_trigger_obj);
        $instance->logout();
    } else {
        die("Login failed, no reason to go on...");
    }
} catch (SoapFault $fault) {
    print_r($fault);
} catch (Exception $exception) {
    print_r($exception);
}
        $preferences->setProgressChunk($progressChunk);
        $preferences->setProgressEmailAddresses("*****@*****.**");
        //$preferences->setRecipientLimit( 1 ); // Limit to only one recipient, good for testing.
        $preferences->setSamplingNthInterval(1);
        $preferences->setSamplingNthOffset(1);
        $preferences->setSamplingNthSelection(1);
        //$proof_options = new ProofLaunchOptions();
        /*
         * To send a proof instead of real message set proof params ( to entire proof list or specified proof email address ) 
         * or leave empty to send live campaign
         * 
        
        $proof_launch_type = new ProofLaunchType();
        $proof_launch_type->setProofLaunchType( ProofLaunchType::TO_ADDRESS_USING_PROOFLIST );
        $proof_options->setProofLaunchType( $proof_launch_type );
        $proof_options->setProofEmailAddresses( "*****@*****.**" );
        */
        $launchCampaign_object = new launchCampaign();
        $launchCampaign_object->setCampaignParam($campaign_object);
        $launchCampaign_object->setLaunchPreferences($preferences);
        //$launchCampaign_object->setProofLaunchOptions($proof_options);
        $instance->execute($launchCampaign_object);
        $instance->logout();
    } else {
        die("Login failed, no reason to go on...");
    }
} catch (SoapFault $fault) {
    print_r($fault);
} catch (Exception $exception) {
    print_r($exception);
}
$instance->debug = true;
$instance->intitializeSoapClient($config_file['location']['wsdl'], $config_file['location']['endpoint']);
if ($instance->login($config_file['auth_content_library']['login'], $config_file['auth_content_library']['pass'])) {
    // init some vars - these are pre-existing objects in my test account
    $content_folder_location = '/contentlibrary/1_mason';
    $content_folder_file = 'randomFile_' . rand(1, 100) . '.htm';
    $some_random_html = '<html><header><title>Masons api example</title></header><body><div><h1>Hello World!</h1></div><div>Goodbye cruel world</div></body></html>';
    // sample of create document call
    $create_document_obj = new createDocument();
    $int_obj = new InteractObject();
    $int_obj->setFolderName($content_folder_location);
    $int_obj->setObjectName($content_folder_file);
    $create_document_obj->setDocumentParam($int_obj);
    $create_document_obj->setContentParam($some_random_html);
    $create_document_obj->setEncodingParameter($create_document_obj->char_sets[10]);
    $create_doc_result = $instance->execute($create_document_obj);
    // sample of setDocumentContent
    $set_content_obj = new setDocumentContent();
    $int_obj = new InteractObject();
    $int_obj->setFolderName($content_folder_location);
    $int_obj->setObjectName($content_folder_file);
    $set_content_obj->setDocumentParam($int_obj);
    $set_content_obj->setContentParam($some_random_html);
    $set_document_response = $instance->execute($set_content_obj);
    // sample of getDocumentContent
    $get_content_obj = new getDocumentContent();
    $folder_location = $content_folder_location;
    $object_name = $content_folder_file;
    $get_content_obj->setDocumentParam($int_obj);
    $result = $instance->execute($get_content_obj);
    print_r($result);