marenkay / phparmory

phpArmory is a PHP class library that can easily fetch and unserialize World of Warcraft Armory XML data into structured associative arrays.

This URL has Read+Write access

phparmory / examples / characterAchievements.php
100644 37 lines (28 sloc) 0.873 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/**
* phpArmory5 test case
*
* A test case to derive a new class object from the phpArmory5 class.
* @package phpArmory
* @subpackage tests
*/
 
// Include the phpArmory class library
require_once ('../phpArmory.class.php');
 
 
$areaName = 'us';
$characterName = "Tsigo";
$characterRealmName = "Mal'Ganis";
 
$sapi_type = substr(php_sapi_name(), 0, 3);
 
// Instantiate the class library
if ( $armory = new phpArmory5($areaName = $areaName) ) {
 
    $ach = $armory->getAchievementData($characterName, $characterRealmName, 'Dungeons & Raids');
    if ($sapi_type == 'cli') {
        var_dump ($ach);
    } else {
        $string = print_r($ach, 1);
        $string = str_replace(array(" ", "\n"), array("&nbsp;", "<br />\n"), $string);
 
        echo "\$character = ".$string;
    }
} else {
    echo "Failed to create a phpArmory5 instance.\n";
}
 
?>