diff options
author | Richard Leland <rich@richleland.com> | 2016-02-25 16:38:28 -0500 |
---|---|---|
committer | Richard Leland <rich@richleland.com> | 2016-02-25 16:38:28 -0500 |
commit | 3c4f858f9d099ae753993a3b2997d1bc1c2dd1d8 (patch) | |
tree | 79dc5fb54be024a023e02340e12be34614cb12fe /examples | |
parent | 7ff00e6104ac19d9a2fe20a8a03df469cb6910f6 (diff) | |
parent | dad35ca70de8bbcdbd3a53e3deb761f961221dea (diff) | |
download | php-sparkpost-3c4f858f9d099ae753993a3b2997d1bc1c2dd1d8.zip php-sparkpost-3c4f858f9d099ae753993a3b2997d1bc1c2dd1d8.tar.gz php-sparkpost-3c4f858f9d099ae753993a3b2997d1bc1c2dd1d8.tar.bz2 |
Merge pull request #39 from SparkPost/issue38
version bump, error response handling
Diffstat (limited to 'examples')
-rw-r--r-- | examples/unwrapped/get_webhooks.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/examples/unwrapped/get_webhooks.php b/examples/unwrapped/get_webhooks.php new file mode 100644 index 0000000..b9ed723 --- /dev/null +++ b/examples/unwrapped/get_webhooks.php @@ -0,0 +1,25 @@ +<?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; + +$httpAdapter = new Guzzle6HttpAdapter(new Client()); +$sparky = new SparkPost($httpAdapter, ['key'=>$config['api-key']]); + +try { + $sparky->setupUnwrapped('webhooks'); + + $results = $sparky->webhooks->get(); + + echo 'Congrats you can use your SDK!'; +} catch (\Exception $exception) { + echo $exception->getMessage(); +} +?> |