コード例 #1
0
<?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);
}
コード例 #2
0
<?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';
try {
    $login = "******";
    $pass = "******";
    $folder = "Mark_J";
    $list = "MJlist4";
    $instance = new interact();
    $instance->debug = true;
    $instance->intitializeSoapClient($config_file['location']['wsdl'], $config_file['location']['endpoint']);
    if ($instance->login($login, $pass)) {
        /*
         * merge call begin
         */
        $merge_obj = new mergeListMembersRIID();
        $interact_object = new InteractObject();
        $interact_object->setFolderName($folder);
        $interact_object->setObjectName($list);
        $merge_obj->setListParam($interact_object);
        $rule = new ListMergeRule();
        $status = new DefaultPermissionStatus();
        $status->defaultPermissionStatus = DefaultPermissionStatus::OPT_IN;
        $rule->setDefaultPermissionStatus($status);
        $rule->setInsertOnNoMatch(true);
        $match1 = new MatchColumn();
        $match1->matchColumn = $match1::EMAIL;
        $rule->setMatchColumn1($match1);
        $match_op = new MatchOperator();
        $match_op->matchOperator = $match_op::_NONE_;
        $rule->setMatchOperator($match_op);
コード例 #4
0
<?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'])) {
        $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);
}
コード例 #5
0
<?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'])) {
        $campaign_object = new InteractObject();
        $campaign_object->setFolderName("Mason");
        $campaign_object->setObjectName("masonCampaign_promo");
        $progressChunk = new ProgressChunk();
        $progressChunk->setProgressChunk($progressChunk::CHUNK_10K);
        $preferences = new LaunchPreferences();
        $preferences->setEnabledLimit(false);
        // Enabled limit on recipients
        $preferences->setEnableNthSampling(true);
        $preferences->setEnableProgressAlerts(true);
        $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();
コード例 #6
0
<?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_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();
コード例 #7
0
 /**
  * 
  * @param string $user
  * @param string $byte_array_challenge
  * @param string $wsdl
  * @param string $endpoint
  * @param string $responsys_public_cert_path
  * @param string $client_private_key_path
  */
 public function loginWithCertificate($user, $byte_array_challenge, $wsdl, $endpoint, $responsys_public_cert_path, $client_private_key_path)
 {
     if (self::$isLoggedIn) {
         if ($this->debug) {
             echo "Attempt to loginWithCertificate when already logged in";
         }
         return false;
     }
     // RESPONSYS PUBLIC CERT
     $responsys_certificate_file = file_get_contents($responsys_public_cert_path);
     // PRIVATE KEY REQUIRED FOR ENCRYPTING SERVER CHALLENGE - obtained from openssl cert & key creation process
     $mdixon_certificate_file = file_get_contents($client_private_key_path);
     $byte_array = array();
     $container = array();
     $container2 = array();
     $container3 = array();
     // Convert to integer for java
     $len = strlen($byte_array_challenge);
     for ($i = 0; $i < $len; $i++) {
         $byte_array[] = ord($byte_array_challenge[$i]);
     }
     // Run authServer call to verify user and get a temporary sessionId for login call
     $result = $this->authServer($user, $byte_array, $wsdl, $endpoint);
     //print_r( $result );
     $authId = $result->result->authSessionId;
     $encServerChallenge = $result->result->encryptedClientChallenge;
     $serverChallenge = $result->result->serverChallenge;
     // Hack to deal with null returns in challenge strings ( weak! )
     // The trick is setting the null value to 128 - which should actually be out of range for java since it uses -128 through 127 but it works...
     foreach ($encServerChallenge as $key => $val) {
         $val = trim($val);
         if (isset($val) && $val !== null && $val !== "") {
             $container[] = $val;
         } else {
             $container[] = 128;
         }
     }
     // Now we have to decrypt the binary string
     $decryptMe = $this->packer($container);
     // USE RESP CERT TO DECYRPT THE VALUE AND DIFF ON ORIGINAL STRING VALUE !!!
     // GET A X509 INSTANCE, THEN GET THE PUBLIC KEY FOR openssl_public_decrypt
     $x509 = openssl_x509_read($responsys_certificate_file);
     openssl_x509_export($x509, $newX509);
     $pubKey = openssl_get_publickey($newX509);
     if (openssl_public_decrypt($decryptMe, $decrypted, $pubKey, OPENSSL_PKCS1_PADDING)) {
         $data = $decrypted;
     } else {
         throw new Exception("Failed to decrypt the challenge " . openssl_error_string());
     }
     // Compare the original string to the decrypted data string
     // If this matches then the decryption logic is proper, and we proceed to login call
     if ($byte_array_challenge == $data) {
         // Get the private key for encrypting the return
         $private_key = openssl_get_privatekey($mdixon_certificate_file);
         foreach ($serverChallenge as $j => $b) {
             $val2 = trim($b);
             if (isset($val2) && $val2 !== null && $val2 !== "") {
                 $container2[] = $val2;
             } else {
                 $container2[] = 128;
             }
         }
         $encryptMe = $this->packer($container2);
         if (!openssl_private_encrypt($encryptMe, $encryptedData, $private_key, OPENSSL_PKCS1_PADDING)) {
             throw new Exception("Failed to Encrypt data with Private Key - exiting");
         }
         // Now we have to unpack data which converts unsigned encrypted data to signed byte type
         // to play nice with java signed byte type
         $unpackedData = unpack('c*', $encryptedData);
         // Now iterate through bytes, and set the 128 values to null since API allows / sends nulls
         foreach ($unpackedData as $m => $d) {
             $val3 = trim($d);
             if ($val3 == 128) {
                 $container3[] = null;
             } else {
                 $container3[] = $val3;
             }
         }
         // Now we have all of the parts, set the authId as the session id for the login call, and send in the prepared encrypted server challenge
         // If all goes well we will get a sessionId in the result of the upcoming call.
         $this->setSoapHeaders($authId);
         $this->setSessionCookie();
         $loginWithCertObj = new loginWithCertificate($container3);
         $result = $this->execute($loginWithCertObj);
         if ($result) {
             $this->sessionId = $result->result->sessionId;
             if (!$this->setSoapHeaders() || !$this->setSessionCookie()) {
                 throw new Exception(self::SOAP_ERROR_HEADER);
             }
             self::$isLoggedIn = true;
         } else {
             throw new Exception(self::SOAP_ERROR_LOGIN);
         }
         //print_r( $result );
         return $result;
     } else {
         throw new SoapFault("Problem during handshake - exiting");
     }
 }
コード例 #8
0
<?php

include '../bootstrap.php';
try {
    $instance = new interact();
    $instance->debug = true;
    $instance->intitializeSoapClient($config_file['hatm_location']['wsdl'], $config_file['hatm_location']['endpoint']);
    if ($instance->login($config_file['auth_hatm']['login'], $config_file['auth_hatm']['pass'])) {
        $merge_trigger_obj = new HAmergeTriggerEmail();
        // Print out XML transmissions - nice to have!
        $merge_trigger_obj->debug = true;
        $rule = new ListMergeRule();
        $status = new DefaultPermissionStatus();
        $status->defaultPermissionStatus = DefaultPermissionStatus::OPT_IN;
        $rule->setDefaultPermissionStatus($status);
        $rule->setInsertOnNoMatch(true);
        $match1 = new MatchColumn();
        $match1->matchColumn = $match1::RECIPIENT_ID;
        $rule->setMatchColumn1($match1);
        $match_op = new MatchOperator();
        $match_op->matchOperator = $match_op::_NONE_;
        $rule->setMatchOperator($match_op);
        $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_trigger_obj->setMergeRuleParam($rule);
        $interact_object = new InteractObject();
        $interact_object->setFolderName("z_ComprehensiveAccountTesting");