summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorbeardyman <nornholdj@gmail.com>2015-09-25 18:31:07 -0400
committerbeardyman <nornholdj@gmail.com>2015-09-25 18:31:07 -0400
commit607806af09c45e1b504ba06c3d33d9cb613d27c2 (patch)
tree3a709b001d1affae913a4dda938f4f45429ce1a4 /examples
parent20b7f920e5527f421049a22227759cfe89318cc3 (diff)
downloadphp-sparkpost-607806af09c45e1b504ba06c3d33d9cb613d27c2.zip
php-sparkpost-607806af09c45e1b504ba06c3d33d9cb613d27c2.tar.gz
php-sparkpost-607806af09c45e1b504ba06c3d33d9cb613d27c2.tar.bz2
updated scripts to make template and updated example files to read new config file
Diffstat (limited to 'examples')
-rw-r--r--examples/transmission/get_all_transmissions.php9
-rw-r--r--examples/transmission/get_transmission.php10
-rw-r--r--examples/transmission/rfc822.php10
-rw-r--r--examples/transmission/send_transmission_all_fields.php10
-rw-r--r--examples/transmission/simple_send.php11
-rw-r--r--examples/transmission/stored_recipients_inline_content.php10
-rw-r--r--examples/transmission/stored_template_send.php10
-rw-r--r--examples/unwrapped/create_template.php12
8 files changed, 56 insertions, 26 deletions
diff --git a/examples/transmission/get_all_transmissions.php b/examples/transmission/get_all_transmissions.php
index db06b68..fb62ec7 100644
--- a/examples/transmission/get_all_transmissions.php
+++ b/examples/transmission/get_all_transmissions.php
@@ -2,11 +2,14 @@
namespace Examples\Transmisson;
require_once (dirname(__FILE__).'/../bootstrap.php');
+//pull in API key config
+$configFile = file_get_contents(dirname(__FILE__) . "/../example-config.json");
+$config = json_decode($configFile, true);
+
use SparkPost\SparkPost;
use SparkPost\Transmission;
-$key = 'YOURAPIKEY';
-SparkPost::setConfig(array('key'=>$key));
+SparkPost::setConfig(array('key'=>$config['api-key']));
try {
$results = Transmission::all();
@@ -14,4 +17,4 @@ try {
} catch (\Exception $exception) {
echo $exception->getMessage();
}
-?> \ No newline at end of file
+?>
diff --git a/examples/transmission/get_transmission.php b/examples/transmission/get_transmission.php
index 574388c..b4781d7 100644
--- a/examples/transmission/get_transmission.php
+++ b/examples/transmission/get_transmission.php
@@ -1,11 +1,15 @@
<?php
namespace Examples\Transmisson;
require_once (dirname(__FILE__).'/../bootstrap.php');
+
+//pull in API key config
+$configFile = file_get_contents(dirname(__FILE__) . "/../example-config.json");
+$config = json_decode($configFile, true);
+
use SparkPost\SparkPost;
use SparkPost\Transmission;
-$key = 'YOURAPIKEY';
-SparkPost::setConfig(array('key'=>$key));
+SparkPost::setConfig(array('key'=>$config['api-key']));
try {
$results = Transmission::find('Your Transmission Id');
@@ -13,4 +17,4 @@ try {
} catch (\Exception $exception) {
echo $exception->getMessage();
}
-?> \ No newline at end of file
+?>
diff --git a/examples/transmission/rfc822.php b/examples/transmission/rfc822.php
index b97bbb9..8163693 100644
--- a/examples/transmission/rfc822.php
+++ b/examples/transmission/rfc822.php
@@ -1,11 +1,15 @@
<?php
namespace Examples\Transmisson;
require_once (dirname(__FILE__).'/../bootstrap.php');
+
+//pull in API key config
+$configFile = file_get_contents(dirname(__FILE__) . "/../example-config.json");
+$config = json_decode($configFile, true);
+
use SparkPost\SparkPost;
use SparkPost\Transmission;
-$key = 'YOURAPIKEY';
-SparkPost::setConfig(array('key'=>$key));
+SparkPost::setConfig(array('key'=>$config['api-key']));
try {
$results = Transmission::send(array(
@@ -22,4 +26,4 @@ try {
} catch (\Exception $exception) {
echo $exception->getMessage();
}
-?> \ No newline at end of file
+?>
diff --git a/examples/transmission/send_transmission_all_fields.php b/examples/transmission/send_transmission_all_fields.php
index 30f7793..28edbcc 100644
--- a/examples/transmission/send_transmission_all_fields.php
+++ b/examples/transmission/send_transmission_all_fields.php
@@ -1,11 +1,15 @@
<?php
namespace Examples\Transmisson;
require_once (dirname(__FILE__).'/../bootstrap.php');
+
+//pull in API key config
+$configFile = file_get_contents(dirname(__FILE__) . "/../example-config.json");
+$config = json_decode($configFile, true);
+
use SparkPost\SparkPost;
use SparkPost\Transmission;
-$key = 'YOURAPIKEY';
-SparkPost::setConfig(array('key'=>$key));
+SparkPost::setConfig(array('key'=>$config['api-key']));
try{
$results = Transmission::send(array(
@@ -40,4 +44,4 @@ try{
} catch (\Exception $exception) {
echo $exception->getMessage();
}
-?> \ No newline at end of file
+?>
diff --git a/examples/transmission/simple_send.php b/examples/transmission/simple_send.php
index 8149238..eafc176 100644
--- a/examples/transmission/simple_send.php
+++ b/examples/transmission/simple_send.php
@@ -1,12 +1,15 @@
<?php
-namespace Examples\Transmisson;
+namespace Examples\Transmisson;
require_once (dirname(__FILE__).'/../bootstrap.php');
+//pull in API key config
+$configFile = file_get_contents(dirname(__FILE__) . "/../example-config.json");
+$config = json_decode($configFile, true);
+
use SparkPost\SparkPost;
use SparkPost\Transmission;
-$key = 'YOURAPIKEY';
-SparkPost::setConfig(array('key'=>$key));
+SparkPost::setConfig(array('key'=>$config['api-key']));
try {
$results = Transmission::send(array(
@@ -26,4 +29,4 @@ try {
} catch (\Exception $exception) {
echo $exception->getMessage();
}
-?> \ No newline at end of file
+?>
diff --git a/examples/transmission/stored_recipients_inline_content.php b/examples/transmission/stored_recipients_inline_content.php
index dbb7c1d..a2dd8aa 100644
--- a/examples/transmission/stored_recipients_inline_content.php
+++ b/examples/transmission/stored_recipients_inline_content.php
@@ -1,11 +1,15 @@
<?php
namespace Examples\Transmisson;
require_once (dirname(__FILE__).'/../bootstrap.php');
+
+//pull in API key config
+$configFile = file_get_contents(dirname(__FILE__) . "/../example-config.json");
+$config = json_decode($configFile, true);
+
use SparkPost\SparkPost;
use SparkPost\Transmission;
-$key = 'YOURAPIKEY';
-SparkPost::setConfig(array('key'=>$key));
+SparkPost::setConfig(array('key'=>$config['api-key']));
try {
@@ -22,4 +26,4 @@ try {
} catch (\Exception $exception) {
echo $exception->getMessage();
}
-?> \ No newline at end of file
+?>
diff --git a/examples/transmission/stored_template_send.php b/examples/transmission/stored_template_send.php
index cda6de6..52dbb27 100644
--- a/examples/transmission/stored_template_send.php
+++ b/examples/transmission/stored_template_send.php
@@ -1,11 +1,15 @@
<?php
namespace Examples\Transmisson;
require_once (dirname(__FILE__).'/../bootstrap.php');
+
+//pull in API key config
+$configFile = file_get_contents(dirname(__FILE__) . "/../example-config.json");
+$config = json_decode($configFile, true);
+
use SparkPost\SparkPost;
use SparkPost\Transmission;
-$key = 'YOURAPIKEY';
-SparkPost::setConfig(array('key'=>$key));
+SparkPost::setConfig(array('key'=>$config['api-key']));
try {
$results = Transmission::send(array(
@@ -23,4 +27,4 @@ try {
} catch (\Exception $exception) {
echo $exception->getMessage();
}
-?> \ No newline at end of file
+?>
diff --git a/examples/unwrapped/create_template.php b/examples/unwrapped/create_template.php
index 717430f..0e24fd6 100644
--- a/examples/unwrapped/create_template.php
+++ b/examples/unwrapped/create_template.php
@@ -1,16 +1,20 @@
<?php
namespace Examples\Unwrapped;
require_once (dirname(__FILE__).'/../bootstrap.php');
+
+//pull in API key config
+$configFile = file_get_contents(dirname(__FILE__) . "/../example-config.json");
+$config = json_decode($configFile, true);
+
use SparkPost\SparkPost;
use SparkPost\APIResource;
-$key = 'YOURAPIKEY';
-SparkPost::setConfig(array('key'=>$key));
+SparkPost::setConfig(array('key'=>$config['api-key']));
try {
// define the endpoint
APIResource::$endpoint = 'templates';
-
+
$templateConfig = array(
'name' => 'Summer Sale!',
'content.from' => 'marketing@bounces.company.example',
@@ -22,4 +26,4 @@ try {
} catch (\Exception $exception) {
echo $exception->getMessage();
}
-?> \ No newline at end of file
+?>