A
A
Alina2016-07-31 19:11:10
PHP
Alina, 2016-07-31 19:11:10

How to get stats in Mailgun?

set up the mailgun API, letters are sent, everything is fine.
I can not set up getting statistics in any way.
I write this code:
<?
ini_set("display_errors","1");
ini_set("display_startup_errors","1");
ini_set('error_reporting', E_ALL);
# Include the Autoloader (see "Libraries" for install instructions)
# Install Composer
require 'vendor/autoload.php';
use Mailgun\Mailgun;
# Instantiate the client.
$client = new \Http\Adapter\Guzzle6\Client();
$mg = new \Mailgun\Mailgun('key-XXXXXXXX, $client);
$domain = 'my-domain.ru';
$result = $mg->get("$domain/stats/total",
'duration' => '1m'
));
?>
In response, there are no errors, a blank page - Blank page
Technical support says that the code is correct, why nothing is displayed - not in their competence.
But, one thing I can point out, is that the response captured in $result is not being printed out or passed into an HTML page to render on your browser.
and sent me googling about echo and print. I tried this way and that to display this result. So far it's useless.
Tell me how to see the result.
The letters were definitely sent and delivered within the last month

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alina, 2016-08-07
@rivaufa

found a solution. You need to add
$result = (var_dump(json_decode(json_encode($result),true)));
and then the answer is displayed in the browser
; now another question is how to put this answer into a variable in order to process the answer?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question