'List all the transactional email activity with Sendinblue

I want to show the result of my transactional email activity page with the sendinblue api (CURL Method), with a table and columns : Email , Subject, events (delivered, cliked etc)

Actually i can only show the first row, i don't know why.

Any help is welcome.

<?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

$curl = curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api.sendinblue.com/v3/smtp/statistics/events?limit=50&offset=0&sort=desc",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => array(
        "accept: application/json",
        "api-key: XXX",
        "content-type: application/json"
    ),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);

$data =  json_decode($response);

echo '<table>';
        foreach($data as $result){
          echo '<tr>';
            echo '<td>'.$result[0]->email.'</td>';
            echo '<td>'.$result[0]->subject.'</td>';
          echo '</tr>';
        }
        echo '</table>';


?>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source