diff options
Diffstat (limited to 'examples/unwrapped/create_template.php')
-rw-r--r-- | examples/unwrapped/create_template.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/examples/unwrapped/create_template.php b/examples/unwrapped/create_template.php new file mode 100644 index 0000000..717430f --- /dev/null +++ b/examples/unwrapped/create_template.php @@ -0,0 +1,25 @@ +<?php +namespace Examples\Unwrapped; +require_once (dirname(__FILE__).'/../bootstrap.php'); +use SparkPost\SparkPost; +use SparkPost\APIResource; + +$key = 'YOURAPIKEY'; +SparkPost::setConfig(array('key'=>$key)); + +try { + // define the endpoint + APIResource::$endpoint = 'templates'; + + $templateConfig = array( + 'name' => 'Summer Sale!', + 'content.from' => 'marketing@bounces.company.example', + 'content.subject' => 'Summer deals', + 'content.html' => '<b>Check out these deals!</b>', + ); + $results = APIResource::sendRequest($templateConfig); + echo 'Congrats you can use your SDK!'; +} catch (\Exception $exception) { + echo $exception->getMessage(); +} +?>
\ No newline at end of file |