D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
shubmkcj
/
urbane.createerp.com
/
testing-same-sendgrid-php
/
examples
/
devices
/
Filename :
devices.php
back
Copy
<?php require 'vendor/autoload.php'; // If you're using Composer (recommended) // comment out the above line if not using Composer // require("./sendgrid-php.php"); // If not using Composer, uncomment the above line $apiKey = getenv('SENDGRID_API_KEY'); $sg = new \SendGrid($apiKey); //////////////////////////////////////////////////// // Retrieve email statistics by device type. # // GET /devices/stats # $query_params = json_decode('{"aggregated_by": "day", "limit": 1, "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": 1}'); try { $response = $sg->client->devices()->stats()->get(null, $query_params); print $response->statusCode() . "\n"; print_r($response->headers()); print $response->body() . "\n"; } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; }