Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added debug option
- Loading branch information
Showing
14 changed files
with
271 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace Examples\Templates; | ||
|
||
require dirname(__FILE__).'/../bootstrap.php'; | ||
|
||
use SparkPost\SparkPost; | ||
use GuzzleHttp\Client; | ||
use Http\Adapter\Guzzle6\Client as GuzzleAdapter; | ||
|
||
$httpClient = new GuzzleAdapter(new Client()); | ||
|
||
/* | ||
* configure options in example-options.json | ||
*/ | ||
$sparky = new SparkPost($httpClient, [ | ||
"key" => "YOUR_API_KEY", | ||
// This will expose your API KEY - do not use this in production. | ||
"debug" => true | ||
]); | ||
|
||
$promise = $sparky->request('GET', 'templates'); | ||
|
||
try { | ||
$response = $promise->wait(); | ||
|
||
var_dump($response); | ||
|
||
echo "Request:\n"; | ||
print_r($response->getRequest()); | ||
|
||
echo "Response:\n"; | ||
echo $response->getStatusCode()."\n"; | ||
print_r($response->getBody())."\n"; | ||
} catch (\Exception $e) { | ||
echo "Request:\n"; | ||
print_r($e->getRequest()); | ||
|
||
echo "Exception:\n"; | ||
echo $e->getCode()."\n"; | ||
echo $e->getMessage()."\n"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.