What is the best practice for outputting data from the World of Warcraft Armory using PHP?

When outputting data from the World of Warcraft Armory using PHP, it is best practice to use the Armory API provided by Blizzard. This API allows you to retrieve player and guild information, such as character stats, achievements, and equipment, in a structured format that is easy to work with in PHP.

<?php
$realm = 'YourRealm';
$character = 'YourCharacter';

$url = 'https://us.api.blizzard.com/wow/character/' . $realm . '/' . $character . '?fields=achievements,items&locale=en_US&access_token=YOUR_ACCESS_TOKEN';

$data = json_decode(file_get_contents($url), true);

if(isset($data['name'])) {
    echo 'Character Name: ' . $data['name'] . '<br>';
    echo 'Achievement Points: ' . $data['achievementPoints'] . '<br>';
    echo 'Item Level: ' . $data['items']['averageItemLevel'] . '<br>';
} else {
    echo 'Character not found.';
}
?>