/var/www/hkosl.com/demo_google/application/vendor/sendgrid/sendgrid/examples/clients/clients.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
// If you are using Composer
require 'vendor/autoload.php';


$apiKey getenv('SENDGRID_API_KEY');
$sg = new \SendGrid($apiKey);

////////////////////////////////////////////////////
// Retrieve email statistics by client type. #
// GET /clients/stats #

$query_params json_decode('{"aggregated_by": "day", "start_date": "2016-01-01", "end_date": "2016-04-01"}');
$response $sg->client->clients()->stats()->get(null$query_params);
echo 
$response->statusCode();
echo 
$response->body();
print_r($response->headers());

////////////////////////////////////////////////////
// Retrieve stats by a specific client type. #
// GET /clients/{client_type}/stats #

$query_params json_decode('{"aggregated_by": "day", "start_date": "2016-01-01", "end_date": "2016-04-01"}');
$client_type "test_url_param";
$response $sg->client->clients()->_($client_type)->stats()->get(null$query_params);
echo 
$response->statusCode();
echo 
$response->body();
print_r($response->headers());