View Single Post
Old 03-12-2009, 02:48 PM   #84 (permalink)
commonmind
The Wanderer
 
Join Date: Mar 2009
Posts: 20
Thanks: 5
commonmind is on a distinguished road
Default

Thanks Krik. When I put the two blocks together, as follows (of course, inserting my own guild's name and server):

PHP Code:
<?php

$url 
'http://www.wowarmory.com/guild-info.xml?r=server=guildname&p=1';
    
$ch curl_init();
    
curl_setopt ($chCURLOPT_URL$url);
    
curl_setopt ($chCURLOPT_RETURNTRANSFERtrue);
    
curl_setopt ($chCURLOPT_USERAGENT,  "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
    
    
$rosterxml curl_exec($ch);
    
    echo 
$rosterxml;  
    
    
$xml = new SimpleXMLElement($rosterxml);

foreach (
$xml->guild->members->children() as $char) {
    echo 
'Name: ' $char['name'] . ' ';
    echo 
'Class: ' $char['class'] . ' ';
    echo 
'Level: ' $char['level'] . ' <br>';
}  
    
?>
I get this error:

Quote:
Fatal error: Call to a member function children() on a non-object in /home/enemy/public_html/roster.php on line 20
I haven't attempted to put in the table code yet.
commonmind is offline  
Reply With Quote