Note of Myself : I have not associated authentication with the content listings on the API server (Creation in development of the client/server API) - Authentication on the content of the docs and the analysis of my DMARC reports (Use the ZW3B Client API).
Simply query the following addresses :
API JSON of news : URL
https://www.zw3b.fr/api/contents/news/lst
API JSON of docs : URL
https://www.zw3b.fr/api/contents/docs/lst https://www.zw3b.fr/api/contents/docs/cid/content_id
API JSON of links : URL
https://www.zw3b.fr/api/contents/links/lst
API JSON of gallery : URL
https://www.zw3b.fr/api/contents/gallery/lst
API JSON of videos : URL
https://www.zw3b.fr/api/contents/videos/lst
API JSON of channels : URL
https://www.zw3b.fr/api/contents/channels/lst
You can configure the following parameters :
offset (starts at - at the last) : 0 (default)limit (number per request) : 10 (default) - You can display a maximum of 30 items at a time.l (language) : FR|EN|ES|AR - Français | English | Español | العربية.Create a zw3b-docs.php file on your Web server and add the code below - Display additional images (I'll let you do it) and other data:
<?php
$l = 'FR'; // Français
$offset = '0'; // starts at - at the last
$limit = '10'; // number of items per page
$json_url_docs_list = 'https://www.zw3b.fr/api/contents/docs/lst?l='.$l.'&offset='.$offset.'&limit='.$limit.'';
$data_docs = file_get_contents($json_url_docs_list);
$read_docs = json_decode($data_docs);
if(isset($read_docs->contents->docs->items) && is_array($read_docs->contents->docs->items)):
echo '<h3>Liste des <a href="https://www.zw3b.fr" title="ZW3B :-: The Web XXI">ZW3B</a> docs ('.$read_docs->contents->docs->count.')</h3>';
foreach($read_docs->contents->docs->items as $doc):
echo '<div class="item docs">';
echo '<h4>DOC : '.$doc->tree->tree_filariane.' : <a href="'.$doc->content_url.'">'.$doc->content_title.'</a></h4>';
echo '<p class="desc">'.$doc->content_description.'</p>';
echo '</div>';
echo '<hr />';
endforeach;
endif;
?>
Fetch content this way - using the "ZW3B Api Client" RESTful JSON API :
Copy/paste on your Web server the PHP Source file "zw3bApiClient.class.phps (2023/02/10)" and rename the file to .php<?php
include '/your_directory/var/lib/php/zw3bApiClient.class.php';
//-------------------------------------------------------------------------
// CLIENT API CALL
$config = array();
//-----------------------
// BETA-TESTERS (Wilcard Origins)
// Minimun config
$config['api_name'] = 'BETA-TESTERS';
$config['client_project']['name'] = 'ZW3B-API-BETA-TESTERS';
// API AUTHENTIFIED
// Default config
#$config['api_name'] = 'MY_API_NAME';
#$config['api_key'] = 'MY_API_KEY';
#$config['client_id'] = 'MY_CLIENT_ID';
#$config['client_secret'] = 'MY_CLIENT_SECRET';
#$config['client_project']['name'] = 'MY_CLIENT_PROJECT_NAME';
#$config['client_project']['origin'] = array('https://www.yoursite.com', 'https://dev.yoursite.com'); // exemple origin URL of your server Web
#$config['client_project']['redirection_url'] = array('https://www.yoursite.com/page.php'); // exemple URL of your server Web
//-----------------------
$zw3bApiClient = new zw3bApiClient();
$my_client = $zw3bApiClient->ClientModUsr($config);
// CLIENT API CALL
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// REQUEST CONTENTS / DOCS / LST
$contents = new zw3bApiClientModContents($my_client);
$docs = $contents->docs()->lst(array(
'offset' => 0,
'limit' => 30,
'l' => 'EN'
)
);
// REQUEST CONTENTS / DOCS / LST
//-------------------------------------------------------------------------
echo '<pre>'.print_r(json_decode($docs),1).'</pre>';
//-------------------------------------------------------------------------
// REQUEST CONTENTS / DOCS / GET / (cid)
$contents = new zw3bApiClientModContents($my_client);
$doc = $contents->docs()->get(array(
'cid' => 2172,
'l' => 'FR'
)
);
// REQUEST CONTENTS / DOCS / GET / (cid)
//-------------------------------------------------------------------------
echo '<pre>'.print_r(json_decode($doc),1).'</pre>';
?>
RESTful JSON API for analyzing spoofing mail servers of my mail domain names : URL with Auth (on owner web site) or API client authentified.
Use the "ZW3B Api Client" API :
Copy/paste on your Web server the PHP Source file "zw3bApiClient.class.phps (2023/02/10)" and rename the file to .phpCreate a zw3b-api-reports-dmarc-analysis.php file on your Web server and add the code below.
<?php
include '/your_directory/var/lib/php/zw3bApiClient.class.php';
//-------------------------------------------------------------------------
// CLIENT API CALL
$config = array();
//-----------------------
// BETA-TESTERS (Wilcard Origins)
// Minimun config
$config['api_name'] = 'BETA-TESTERS';
$config['client_project']['name'] = 'ZW3B-API-BETA-TESTERS';
//-----------------------
$zw3bApiClient = new zw3bApiClient();
$my_client = $zw3bApiClient->ClientModUsr($config);
// CLIENT API CALL
//-------------------------------------------------------------------------
//echo '<pre>'.print_r(($my_client),1).'</pre>';
//-------------------------------------------------------------------------
// REQUEST REPORTS / DMARC / ANALYSIS
$reports = new zw3bApiClientModReports($my_client);
$analysis = $reports->dmarc()->analysis());
$read_analysis = json_decode($analysis);
// REQUEST REPORTS / DMARC / ANALYSIS
//-------------------------------------------------------------------------
//echo '<pre>'.print_r(($read_analysis),1).'</pre>';
//-------------------------------------------------------------------------
// HTML > HEAD
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n";
echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'."\n";
echo '<head>'."\n";
echo '<title>ZW3B :-: API Client * Reports * DMARC * Analysis</title>'."\n";
echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>'."\n";
echo '<meta http-equiv="cache-control" content="no-cache"/>'."\n";
echo '<meta http-equiv="Pragma" content="no-cache"/>'."\n\n";
echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>'."\n";
echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.3/js/jquery.tablesorter.min.js" integrity="sha512-qzgd5cYSZcosqpzpn7zF2ZId8f/8CHmFKZ8j7mU4OUXTNRd5g+ZHBPsgKEwoqxCtdQvExE5LprwwPAgoicguNg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>'."\n\n";
echo '<script type="text/javascript" src="https://www.zw3b.site/sys/modules/reports/dmarc/skins/zw3b-site/js/dmarc-analysis-sortable.js"></script>'."\n";
echo '<link rel="stylesheet" type="text/css" href="https://www.zw3b.site/sys/modules/reports/dmarc/skins/zw3b-site/css/dmarc-analysis.css" />'."\n\n";
echo '<link rel="shortcut icon" href="https://www.zw3b.site/skins/zw3b-site/css/img/zw3b-logo-20x20.png" />'."\n\n";
echo '</head>'."\n";
// HTML > HEAD
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// HTML > BODY
echo '<body>'."\n";
echo '<h1><a href="https://www.zw3b.fr">ZW3B</a> :-: <a href="https://api.zw3b.fr">API Client</a> * Reports * <a href="https://www.zw3b.site/dmarc/">DMARC</a> * <a href="https://www.zw3b.site/dmarc/analysis">Analysis</a> by LAB3W.<acronym title="O.Romain.Jaillet-ramey" lang="FR">ORJ</acronym></h1>'."\n";
//-------------------------------------------------------------------------
// Infos Client
$my_client = ($my_client);
if(isset($my_client) && isset($my_client->authentification->client) && is_object($my_client->authentification->client))
{
if(isset($my_client->authentification->client->name))
echo '<p>Name : '.$my_client->authentification->client->name.'</p>'."\n";
if(isset($my_client->authentification->project) && is_object($my_client->authentification->project) && isset($my_client->authentification->project->name))
echo '<p>Project name : '.$my_client->authentification->project->name.'</p>'."\n";
}
if(isset($my_client->authentification->message))
{
echo '<p>';
echo ''.$my_client->authentification->message.' - ';
if(isset($my_client->authentification->reason) && is_object($my_client->authentification->reason) && isset($my_client->authentification->reason->status))
echo '<span>'.$my_client->authentification->reason->status.' - '.$my_client->authentification->reason->text.'</span>';
echo '</p>'."\n";
}
// Infos Client
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// Reports / DMARC / Analysis
if(isset($read_analysis->dmarc->servers_error) && is_array($read_analysis->dmarc->servers_error)):
# Hide SPF (valid) rows in HTML table
define('HIDE_MY_SPF_LINE_IN_TABLE', true);
echo '<h2>DMARC ANALYSIS</h2>'."\n";
//-----------------------------------------
echo '<h3>Mail server : '.$read_analysis->dmarc->infos->mailserver.'</h3>'."\n";
echo '<blockquote>';
echo 'Mail server <acronym title="Sender Policy Framework" lang="EN">SPF</acronym> authorized : '."\n";
foreach($read_analysis->dmarc->infos->spf as $k => $my_spf):
echo '<code>'.$my_spf.'</code> '.(count($read_analysis->dmarc->infos->spf)-1 > $k ? ' | ' : '')."\n";
endforeach;
echo '</blockquote>'."\n";
echo '<p>Period : </p>'."\n";
echo '<ul>'."\n";
echo '<li>Date since : '.$read_analysis->dmarc->infos->date->since->year.'/'.$read_analysis->dmarc->infos->date->since->month.'</li>'."\n";
echo '<li>Date until : '.$read_analysis->dmarc->infos->date->until->year.'/'.$read_analysis->dmarc->infos->date->until->month.'</li>'."\n";
echo '</ul>'."\n";
echo '<h3>List of spoofing mail servers ('.$read_analysis->dmarc->count->servers_error.')</h3>'."\n";
echo '<table id="global_stats_spoofers" class="rapport sortable">'."\n";
echo '<thead>'."\n";
echo '<tr class="label">'."\n";
echo '<th>Conformance</th>'."\n";
echo '<th>Address IP</th>'."\n";
echo '<th>Emails Volume</th>'."\n";
echo '<th>Mail Server Spoofing</th>'."\n";
echo '<th><acronym title="Autonomous System Number" lang="EN">ASN</acronym></th>'."\n";
echo '<th>Last Date</th>'."\n";
echo '</tr>'."\n";
echo '</thead>'."\n";
echo '<tbody>'."\n";
$count_my_spf = 0;
$count_my_error_mail = 0;
foreach($read_analysis->dmarc->servers_error as $item):
$req_if_hide_my_spf = constant('HIDE_MY_SPF_LINE_IN_TABLE') === true ? !in_array($item->address_ip, $read_analysis->dmarc->infos->spf) : true;
$get_class = !in_array($item->address_ip, $read_analysis->dmarc->infos->spf) ? 'error ip' : 'error';
$count_my_spf += constant('HIDE_MY_SPF_LINE_IN_TABLE') === true && in_array($item->address_ip, $read_analysis->dmarc->infos->spf) ? 1 : 0;
$count_my_error_mail += in_array($item->address_ip, $read_analysis->dmarc->infos->spf) ? (constant('HIDE_MY_SPF_LINE_IN_TABLE') === true ? $item->count_mails_error : 0) : 0;
if($req_if_hide_my_spf)
{
echo '<tr class="data '.$get_class.'">'."\n";
echo '<td class="auth">'.$item->auth.'</td>'."\n";
echo '<td class="addr_ip">'.$item->address_ip.'</td>'."\n";
echo '<td class="count">'.number_format($item->count_mails_error).'</td>'."\n";
echo '<td class="nameserver">'.$item->fqdn.'</td>'."\n";
echo '<td class="asn">';
$code3 = geoip_country_code3_by_name($item->address_ip);
$asn = geoip_asnum_by_name($item->address_ip);
$city = geoip_record_by_name($item->address_ip)['city'];
$country = geoip_record_by_name($item->address_ip)['country_name'];
echo $asn !== false ? ''.$asn.'' : '';
echo $code3 !== false ? ' ('.$code3.')' : '';
echo $city !== false ? ' '.$city.'' : '';
echo $country !== false ? ' '.$country.'' : '';
echo '</td>'."\n";
echo '<td class="date">'.$item->date->year.'/'.$item->date->month.'</td>'."\n";
echo '</tr>'."\n";
}
endforeach;
echo '</tbody>'."\n";
echo '</table>'."\n";
echo '<p>Count : </p>'."\n";
echo '<ul>'."\n";
//echo '<li>Emails sent : '.number_format($read_analysis->dmarc->count->emails->sent).'</li>'."\n";
//echo '<li>Emails past : '.number_format($read_analysis->dmarc->count->emails->passed).'</li>'."\n";
echo '<li>Emails sent unauthorized : '.number_format($read_analysis->dmarc->count->emails->errors - $count_my_error_mail).'</li>'."\n";
echo '<li>Number of email sender servers in error : '.number_format($read_analysis->dmarc->count->servers_error - $count_my_spf).'</li>'."\n";
echo '</ul>'."\n";
echo '<hr /><br /><br />'."\n";
//-----------------------------------------
endif;
// Reports / DMARC / Analysis
//-------------------------------------------------------------------------
echo '</body>'."\n";
echo '</html>'."\n";
// HTML > BODY
//-------------------------------------------------------------------------
?>
Example of analysis rendering of our DMARC reports (PHPSource)
NoM : Development phase - Thank you for your understanding.
© 2011-2025 ZW3B.FR : The Web XXI by LAB3W : Web and networks laboratory - InterNet engineering - All rights reserved
20210828-20230528 © API.ZW3B.FR by O.Romain Jaillet-ramey
