summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/transmission/get_all_transmissions.php7
-rw-r--r--examples/transmission/get_transmission.php7
-rw-r--r--examples/transmission/rfc822.php8
-rw-r--r--examples/transmission/send_transmission_all_fields.php8
-rw-r--r--examples/transmission/simple_send.php7
-rw-r--r--examples/transmission/stored_recipients_inline_content.php8
-rw-r--r--examples/transmission/stored_template_send.php8
-rw-r--r--examples/unwrapped/create_template.php8
8 files changed, 45 insertions, 16 deletions
diff --git a/examples/transmission/get_all_transmissions.php b/examples/transmission/get_all_transmissions.php
index bc57466..7baf4f1 100644
--- a/examples/transmission/get_all_transmissions.php
+++ b/examples/transmission/get_all_transmissions.php
@@ -2,13 +2,16 @@
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 GuzzleHttp\Client;
use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-$key = 'YOUR API KEY';
$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key'=>$key]);
+$sparky = new SparkPost($httpAdapter, ['key'=>$config['api-key']]);
try {
$results = $sparky->transmission->all();
diff --git a/examples/transmission/get_transmission.php b/examples/transmission/get_transmission.php
index 9303eca..1e749b9 100644
--- a/examples/transmission/get_transmission.php
+++ b/examples/transmission/get_transmission.php
@@ -2,13 +2,16 @@
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 GuzzleHttp\Client;
use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-$key = 'YOUR API KEY';
$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key'=>$key]);
+$sparky = new SparkPost($httpAdapter, ['key'=>$config['api-key']]);
try {
$results = $sparky->transmission->find('Your Transmission ID');
diff --git a/examples/transmission/rfc822.php b/examples/transmission/rfc822.php
index 2b10423..b11b34f 100644
--- a/examples/transmission/rfc822.php
+++ b/examples/transmission/rfc822.php
@@ -1,13 +1,17 @@
<?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 GuzzleHttp\Client;
use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-$key = 'YOUR API KEY';
$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key'=>$key]);
+$sparky = new SparkPost($httpAdapter, ['key'=>$config['api-key']]);
try {
$results = $sparky->transmission->send([
diff --git a/examples/transmission/send_transmission_all_fields.php b/examples/transmission/send_transmission_all_fields.php
index ea2a24d..044dcc2 100644
--- a/examples/transmission/send_transmission_all_fields.php
+++ b/examples/transmission/send_transmission_all_fields.php
@@ -1,13 +1,17 @@
<?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 GuzzleHttp\Client;
use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-$key = 'YOUR API KEY';
$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key'=>$key]);
+$sparky = new SparkPost($httpAdapter, ['key'=>$config['api-key']]);
try{
$results = $sparky->transmission->send([
diff --git a/examples/transmission/simple_send.php b/examples/transmission/simple_send.php
index 34df573..6dc3719 100644
--- a/examples/transmission/simple_send.php
+++ b/examples/transmission/simple_send.php
@@ -2,13 +2,16 @@
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 GuzzleHttp\Client;
use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-$key = 'YOUR API KEY';
$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key'=>$key]);
+$sparky = new SparkPost($httpAdapter, ['key'=>$config['api-key']]);
try {
$results = $sparky->transmission->send([
diff --git a/examples/transmission/stored_recipients_inline_content.php b/examples/transmission/stored_recipients_inline_content.php
index 9f3a55d..3e53507 100644
--- a/examples/transmission/stored_recipients_inline_content.php
+++ b/examples/transmission/stored_recipients_inline_content.php
@@ -1,13 +1,17 @@
<?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 GuzzleHttp\Client;
use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-$key = 'YOUR API KEY';
$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key'=>$key]);
+$sparky = new SparkPost($httpAdapter, ['key'=>$config['api-key']]);
try {
diff --git a/examples/transmission/stored_template_send.php b/examples/transmission/stored_template_send.php
index 60363ba..936d292 100644
--- a/examples/transmission/stored_template_send.php
+++ b/examples/transmission/stored_template_send.php
@@ -1,13 +1,17 @@
<?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 GuzzleHttp\Client;
use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-$key = 'YOUR API KEY';
$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key'=>$key]);
+$sparky = new SparkPost($httpAdapter, ['key'=>$config['api-key']]);
try {
$results = $sparky->transmission->send([
diff --git a/examples/unwrapped/create_template.php b/examples/unwrapped/create_template.php
index 51ab156..e28f158 100644
--- a/examples/unwrapped/create_template.php
+++ b/examples/unwrapped/create_template.php
@@ -1,13 +1,17 @@
<?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 GuzzleHttp\Client;
use Ivory\HttpAdapter\Guzzle6HttpAdapter;
-$key = 'YOUR API KEY';
$httpAdapter = new Guzzle6HttpAdapter(new Client());
-$sparky = new SparkPost($httpAdapter, ['key'=>$key]);
+$sparky = new SparkPost($httpAdapter, ['key'=>$config['api-key']]);
try {
// define the endpoint