WoW Armory, for my personal site

Eulogy

2[H]4U
Joined
Nov 9, 2005
Messages
3,124
So, I've been looking and reading, and apparently while possible, this is something difficult to do.
Moving past the moral debate of stealing someone else's work (images, text etc.), here is what I want to do.
I like my WoW Characters. For now, what I'm planning on doing is just using an iframe and hotlinking to the WoW Armory.
What I would like to do though, is directly integrate only the content that is relevant to my toon on my page.
So, I only have a couple of options...
1) Build out my own DB, adding in the relevant content that I need (items, pictures, info etc.)
2) Somehow use Blizzard's db and just get the relevant content to my site (all while giving credit/banner to WoW armory. Doesn't offset it, but makes me feel slightly better).

There may be other options, I just can't think of any at this time.

So here's a test I did along the lines of option 2...
http://thousandwatts.com/wow.php

Yup, it's busted. I cannot find the forum/thread which I found the php code for this, so I can't go back to them for help :-/.
I'm a PHP n00b. Heck, I'm not even a n00b, this is the first I've done much of anything with PHP. I'm not a coder or a web developer, I just poke around in HTML and CSS for my stuff.
Can anyone help? Is this even a good path to take, or is there a better way?
 
posting the code would be nice. Please use
Code:
 tags [/ code] when posting it
 
So I'm basing this off the assumption that you have no idea what you're really doing (no offense :)):

WoW Armory is XML based, with XSLT stylesheets formatting the page for "html" display. When you send a PHP request for the contents, it's easier to send a browser user agent so you get the XML contents so the info is easier to parse through and get what you want.

Find a good XML library to use and you can go from there. You can also try to set up a cron job to slowly download the images from the armory as well.
 
posting the code would be nice. Please use
Code:
 tags [/ code] when posting it[/QUOTE]
See below :)
[quote="KRiTiKuL FX, post: 1034882037"]So I'm basing this off the assumption that you have no idea what you're really doing (no offense :)):
[/QUOTE]
No offense taken at all. Like I said, I don't touch PHP at all. I hardly do anything at all with HTML and CSS. Just enough to have some fun and waste time with.
[quote="KRiTiKuL FX, post: 1034882037"]
WoW Armory is XML based, with XSLT stylesheets formatting the page for "html" display.  When you send a PHP request for the contents, it's easier to send a browser user agent so you get the XML contents so the info is easier to parse through and get what you want.
[QUOTE]
In english? :confused: hehe
[quote="KRiTiKuL FX, post: 1034882037"]
Find a good XML library to use and you can go from there.  You can also try to set up a cron job to slowly download the images from the armory as well.[/QUOTE]

[code]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>
      Selta
    </title>
    <link href="/css/wow1.css" media="screen" rel="stylesheet" type="text/css" />
    <link href="/css/wow2.css" media="screen" rel="stylesheet" type="text/css" />
  </head>
<body>
<?php
class armory {

 const BROWSER="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2) Gecko/20070319 Firefox/2.0.0.3";

 public $query;
 public $server;
 public $guild;
 public $guildie;
 public $page;

public function __construct ( $query, $server, $guild, $guildie, $page ) {
    $this->query = $query;
    $this->server = $server;
    $this->guild = $guild;
    $this->guildie = $guildie;
    $this->page = $page;
 } // end of __construct()

public function pull_xml() {

    // change the first part of the $url to the armory link that you need
    if( $this->query === 'roster' ){
        $url = 'http://eu.wowarmory.com/guild-info.xml?r=' . urlencode($this->server) . '&n=' . urlencode($this->guild) . '&p=' . $this->page;
        
      }elseif( $this->query === 'character' ){
        $url = 'http://eu.wowarmory.com/character-sheet.xml?r=' . urlencode($this->server) . '&n=' . $this->guildie;
        
        }  

    $ch = curl_init();
    curl_setopt ($ch, CURLOPT_URL, $url);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 15);
    curl_setopt ($ch, CURLOPT_USERAGENT,  self::BROWSER);
    
    $url_string = curl_exec($ch);
    curl_close($ch);
    return simplexml_load_string($url_string);
    
   
 } // end of pull_xml()

} // end class 

?>

<?php

$armory = new armory(character, borean+tundra, ad+infinium, selta, NULL);
$xml = $armory->pull_xml(); 

?>
</body>

Thank you for your help so far. I appreciate it.
 
Code:
<?php

[B]$armory = new armory(character, borean+tundra, ad+infinium, selta, NULL);[/B]
$xml = $armory->pull_xml(); 

?>
</body>

The bold line needs all the arguments passed as strings, sans the last argument. When you were trying to pass them without quotes, PHP is seeing them as named constants that are undeclared, hence the PHP error "unexpected T_CONST".

It should look like:
Code:
$armory = new armory("character", "borean+tundra", "ad+infinium", "selta", NULL);
 
Code:
<?php

[B]$armory = new armory(character, borean+tundra, ad+infinium, selta, NULL);[/B]
$xml = $armory->pull_xml(); 

?>
</body>

The bold line needs all the arguments passed as strings, sans the last argument. When you were trying to pass them without quotes, PHP is seeing them as named constants that are undeclared, hence the PHP error "unexpected T_CONST".

It should look like:
Code:
$armory = new armory("character", "borean+tundra", "ad+infinium", "selta", NULL);

Like I said... I'm a n00b. Let me see where that gets me. Thanks mate!
 
OK, so I inserted quotes around those. I tried single (') and double (") but it still blows up on line 14. This line:
Code:
 const BROWSER="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2) Gecko/20070319 Firefox/2.0.0.3";

I tried googling that particular function, but it hasn't made sense just yet.
 
Back
Top