103 |
- |
1 |
<?php
|
|
|
2 |
// If you are using Composer
|
|
|
3 |
require 'vendor/autoload.php';
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
$apiKey = getenv('SENDGRID_API_KEY');
|
|
|
7 |
$sg = new \SendGrid($apiKey);
|
|
|
8 |
|
|
|
9 |
////////////////////////////////////////////////////
|
|
|
10 |
// Retrieve global email statistics #
|
|
|
11 |
// GET /stats #
|
|
|
12 |
|
|
|
13 |
$query_params = json_decode('{"aggregated_by": "day", "limit": 1, "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": 1}');
|
|
|
14 |
$response = $sg->client->stats()->get(null, $query_params);
|
|
|
15 |
echo $response->statusCode();
|
|
|
16 |
echo $response->body();
|
|
|
17 |
echo $response->headers();
|