Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into Dot9
Browse files Browse the repository at this point in the history
  • Loading branch information
smunuswami authored Jul 11, 2017
2 parents 889ef48 + d564503 commit c79126b
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ config.php
/objsamples/ExactTargetWSDL.xml
/objsamples/AllTest.bat
.DS_Store
objsamples/sample-testing.php
28 changes: 26 additions & 2 deletions ET_Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,27 @@ function CreateWSDL($wsdlLoc) {
}
}

function LocalWsdlPath()
{
$wsdlName = 'ExactTargetWSDL.xml';
$tmpPath = '';

// if open_basedir is set then we cannot trust sys_get_temp_dir()
// see http://php.net/manual/en/function.sys-get-temp-dir.php#97044
if ('' === ini_get('open_basedir')) {
$tmpPath = sys_get_temp_dir();

// sys_get_temp_dir() does not return a trailing slash on all OS's
// see http://php.net/manual/en/function.sys-get-temp-dir.php#80690
if ('/' !== substr($tmpPath, -1)) {
$tmpPath .= '/';
}
}

return "{$tmpPath}{$wsdlName}";

}

function GetLastModifiedDate($remotepath) {
$curl = curl_init($remotepath);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
Expand Down Expand Up @@ -1620,15 +1641,18 @@ function __construct() {
}

class ET_TriggeredSend extends ET_CUDSupport {
public $subscribers, $folderId;
public $subscribers, $folderId, $client;
function __construct() {
$this->obj = "TriggeredSendDefinition";
$this->folderProperty = "CategoryID";
$this->folderMediaType = "triggered_send";
}

public function Send() {
public function Send( $clientMID = null ) {
$tscall = array("TriggeredSendDefinition" => $this->props , "Subscribers" => $this->subscribers);
if( !empty( $clientMID ) && "string" == gettype( $clientMID ) ) {
$tscall["Client"] = array( "ID" => $clientMID );
}
$response = new ET_Post($this->authStub, "TriggeredSend", $tscall);
return $response;
}
Expand Down
3 changes: 2 additions & 1 deletion config.php.template
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
return array(
'appsignature' => 'none',
'appsignature' => 'none',
'clientid' => 'CCCCCCCCCCCCCCCCCCCCCCC',
'clientsecret' => 'CCCCCCCCCCCCCCCCCCCCCCC',
'defaultwsdl' => 'https://webservice.exacttarget.com/etframework.wsdl',
'xmlloc' => '/some/path/to/cache/ExactTargetWSDL.xml',
);
?>
16 changes: 16 additions & 0 deletions objsamples/sample-triggeredsend.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,22 @@
print_r($sendResult->results);
print "\n---------------\n";

$clientMID = '0000001';

// Send an email with TriggeredSend with Client context
print_r("Send an email using a triggered send with Client context\n");
$sendTrigger = new ET_TriggeredSend();
$sendTrigger->props = array('CustomerKey' => 'TEXTEXT');
$sendTrigger->authStub = $myclient;
$sendTrigger->subscribers = array(array("EmailAddress" => "[email protected]", "SubscriberKey" => "[email protected]"));
$sendResult = $sendTrigger->send( $clientMID );
print_r('Send Status: '.($sendResult->status ? 'true' : 'false')."\n");
print 'Code: '.$sendResult->code."\n";
print 'Message: '.$sendResult->message."\n";
print 'Results: '."\n";
print_r($sendResult->results);
print "\n---------------\n";

// Generate a unique identifier for the TriggeredSend customer key since they cannot be re-used even after deleted
$TSNameForCreateThenDelete = uniqid();

Expand Down

0 comments on commit c79126b

Please sign in to comment.