Pastes:104587  Views:2160782 

Languages:

   ASP
   C#
   C++
   HTML
   Java
   PHP
   VB.NET
   Visual Basic 6

more languages available...


Looking to freelance?


Warning: file_get_contents(http://www.getafreelancer.com/affiliates/itsdan/6f.txt) [function.file-get-contents]: failed to open stream: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? in /home/nmp/public_html/support/googlereferrals.php on line 21
( bids)

Source: GetAFreelancer.com


3D Engine with 3D Studio Max Plugin

 

 

 

 

 

 

Here's the requested code from the pastebin:

Wrap Lines   Use Line Numbers
<?php 
//This php file is built to pull armory data from the World of Warcraft Amory site.
//Built by: Zxile - Drenden US
//Built mainly for Lhivera's Mage Theorycraft-o-Matic
//This document requires php 5, due to the use of the SimpleXML parser.
 
//Function: pull_stats
//Takes 3 variables
//name = Name of the character
//Server = Server the character is located on.  Note: This function automatically converts Server Names with spaces into url compatiable strings
//Region = US or EU
//----------------------------
//Returns
//false; if the character is not found
//Stats array; if character was present.
function pull_stats($name, $realm, $region='us') {
  //Decide between EU and US armory sites.
  if($region == 'eu') {
    $baseurl = 'http://eu.wowarmory.com/';
  }
  else {
    $baseurl = 'http://www.wowarmory.com/';
  }
 
  //$server = str_replace(' ', '+', $server);//Replace spaces with +
 
   //ini_set('user_agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6'); //Set User Agent to make armory page think we're calling from a browser, GG Blizzard
  ini_set('user_agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6'); //Set User Agent to make armory page think we're calling from a browser, GG Blizzard
 
   $character_url = $baseurl . "character-sheet.xml?r=" . urlencode(stripslashes($realm)) . "&n=" . urlencode(stripslashes($name));
   $talents_url = $baseurl . "character-talents.xml?r=" . urlencode(stripslashes($realm)) . "&n=" . urlencode(stripslashes($name));
   echo "$character_url<br>";
  //$queryurl = $baseurl . 'character-sheet.xml?r=' . $server . '&n=' . $name; //Setup URL for Query
  //$queryurl2 = $baseurl . 'character-talents.xml?r=' . $server . '&n=' . $name; //Setup URL for Query
  //$xmldoc = simplexml_load_file($queryurl); //Pull Stat data from Armory
   $char = simplexml_load_file($character_url); 
  //$xmldoc2 = simplexml_load_file($queryurl2); 
   $talents = simplexml_load_file($talents_url); 
 
 
  if($char->characterInfo['errCode'] == 'noCharacter' ) {
      echo "Character not found.<br>";
    return false; //Character not found
  } else { //Parse Stats
    $stats = array(); //instantiate the array
 
    $chardata = $char->characterInfo->character;
    //Race
    $stats['Race'] = (string) $chardata['race'];
    $stats['Class'] = (string) $chardata['class'];
      $stats['GuildName'] = (string) $chardata['guildName'];
 
    $statsdata = $char->characterInfo->characterTab; //Root of charcter data    
 
    //Base Stats
      $stats['GuildName'] = (string) $char->characterInfo->character['guildName'];
    $stats['Stamina'] = (string) $statsdata->baseStats->stamina['effective'];
    $stats['Intellect'] = (string) $statsdata->baseStats->intellect['effective'];
    $stats['Spirit'] = (string) $statsdata->baseStats->spirit['effective'];
    $stats['Strength'] = (string) $statsdata->baseStats->strength['effective'];
    $stats['Agility'] = (string) $statsdata->baseStats->agility['effective'];
 
    //Spell Stats (Dmg, Crit, Hit)
    $stats['Arcane Damage'] = (string) $statsdata->spell->bonusDamage->arcane['value'];
    $stats['Fire Damage'] = (string) $statsdata->spell->bonusDamage->fire['value'];
    $stats['Frost Damage'] = (string) $statsdata->spell->bonusDamage->frost['value'];
    $stats['Shadow Damage'] = (string) $statsdata->spell->bonusDamage->shadow['value'];
    $stats['Nature Damage'] = (string) $statsdata->spell->bonusDamage->nature['value'];
    $stats['Holy Damage'] = (string) $statsdata->spell->bonusDamage->holy['value'];
    $stats['Healing'] = (string) $statsdata->spell->bonusHealing['value'];
    $stats['Spell Hit Rating'] = (string) $statsdata->spell->hitRating['value'];
    $stats['Spell Crit Rating'] = (string) $statsdata->spell->critChance['rating'];
    //NOTE: Spell Haste is not yet supported in the WoW Armory
 
    //Pull Spec Information
    $specstring = (string) $talents->characterInfo->talentTab->talentTree['value'];
    $stats['Arcane Mind'] = substr($specstring, 14, 1);//Arcane Mind points
    $stats['Mind Mastery'] = substr($specstring, 21, 1);//Arcane Mind points
 
    $stats['Arcane Pts'] = (string) $statsdata->talentSpec['treeOne'];
    $stats['Fire Pts'] = (string) $statsdata->talentSpec['treeTwo'];
    $stats['Frost Pts'] = (string) $statsdata->talentSpec['treeThree'];
 
    $buffsdata = $char->characterInfo->characterTab->buffs;
    $buffs = array();
    $i = 0;
    while (1) {
      if ($buffsdata->spell[$i]) {
        $buffs[] = $buffsdata->spell[$i]['name'];
        $i++;
      } else {
        break;
      }
    }
    $stats['Buffs'] = $buffs;
 
    return $stats;
  }
}//end Function pull_stats
?>
Syntax Highlighting:  



Copyright 2007 - NoMorePasting.com