diff options
Diffstat (limited to 'examples/unwrapped/create_template.php')
-rw-r--r-- | examples/unwrapped/create_template.php | 12 |
1 files changed, 8 insertions, 4 deletions
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 +?> |