Mailgun response parsing php

Below is the code to fetch the logs from mailgun

require 'mailgun-php/vendor/autoload.php';
use Mailgun\Mailgun;

Instantiate the client.

$mgClient = new Mailgun('xxx');
$domain = 'xx';

Issue the call to the client.

$queryString = array(
    'begin'        => 'Fri, 31 May 2017 09:00:00 -0000',
    'ascending'    => 'yes',
    'limit'        =>  100
);

Make the call to the client.

$result = $mgClient->get("$domain/events", $queryString);`

Mailgun shows some response, now how can i parse the response?

like i want

<td>email@gmail.com</td><td>status</td>

Documentation suggests it comes back as a JSON-encoded object, and the example page (here https://documentation.mailgun.com/api-events.html#examples ) gives the layout. I’d imagine running through the items[] with a foreach() loop would allow you to access all the information you need.

I don’t see a “status” field in there, unless you mean the “event” field that appears to be “accepted” in the example.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.