View Single Post
Old 07-04-2009, 03:24 PM   #1 (permalink)
talonos
The Wanderer
 
Join Date: Jul 2009
Posts: 10
Thanks: 1
talonos is on a distinguished road
Default cant work this error out

ok i've been working on a world of warcraft armory parser for achievements and for some reason its showing an error even thou the other pages i have just like this one work fine

CODE:
PHP Code:
#!/usr/bin/php 
<?php 


// Include phpbb's config for db info 
//include("config.php"); 

echo 'Working...' '</br>'

/* 
roster_gen class posted by D1g1talS0ul on elitistjerks.com 
*/ 

class roster_gen 

 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() { 

    if( 
$this->query === 'roster' ) { 
        
$url 'http://eu.wowarmory.com/guild-info.xml?r=' $this->server '&n=' $this->guild'&p=' $this->page
         
    } elseif( 
$this->query === 'character' ) { 
        
$url 'http://eu.wowarmory.com/character-sheet.xml?r=' $this->server '&n=' $this->guildie
     
    } elseif( 
$this->query === 'achievements' ) { 
        
$url 'http://eu.wowarmory.com/character-achievements.xml?r=' $this->server '&cn=' $this->guildie '&gn=' .  
            
$this->guild '&c=168'
    } 

    
$ch curl_init(); 
    
curl_setopt ($chCURLOPT_URL$url); 
    
curl_setopt ($chCURLOPT_RETURNTRANSFER1); 
    
curl_setopt ($chCURLOPT_CONNECTTIMEOUT60); 
    
curl_setopt ($chCURLOPT_USERAGENT,  roster_gen::BROWSER); 
     
    
$url_string curl_exec($ch); 

    return 
simplexml_load_string($url_string); 
     
    
curl_close($ch); 
 } 
// end of pull_xml() 

// end class 

$roster = new roster_gen ('roster''stormrage''heroes+of+warcraft'NULL1); 
$xml_roster $roster->pull_xml(); 


// Change to querying achievements 
$roster->query=achievements

// Set up the member array 
$member_data = array(); 
$id 0


foreach (
$xml_roster->guildInfo->guild->members->character as $char

    if (
$char['level'] == 80 && $char['rank'] <= '2' ) { 

        
$roster->guildie $char['name']; 
         
        
$xml_char $roster->pull_xml(); 

        
$ach find_category($xml_char->category); 

        
$a = array(); 

        
$a[0] = check_achievement($ach0); 
        
$a[1] = check_achievement($ach1); 
        
$a[2] = check_achievement($ach2); 
        
$a[3] = check_achievement($ach3); 
        
$a[4] = check_achievement($ach4); 
        
$a[5] = check_achievement($ach5); 

         
        
$member_data[$id] = array( 
                                
'name' => $char['name'], 
                                
'0' => $a[0], 
                                
'1' => $a[1], 
                                
'2' => $a[2], 
                                
'3' => $a[3], 
                                
'4' => $a[4], 
                                
'5' => $a[5]
                                ); 
                                 
        
// Provide some output that it's doing stuff 
        
echo 'Updated: <b>' $char['name'] . '</b> ' $a[0] . '-' $a[1] . '-' $a[2] . '-' $a[3] . '-' $a[4] . '-' $a[5] . '</br>'
                                 
        
$id++;                         
    } 
     
}  
/*
echo '</br>Inserting values into DB...</br>'; 

// Connect to the DB 
$db = mysql_connect($dbhost, $dbuser, $dbpasswd); 
$db_selected = mysql_select_db($dbname, $db); 

foreach ($member_data as $member) 

    $name = $member['name']; 

    $sql = "insert into ach_data2(name, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14)  
       VALUES ('$name', '$a[0]', '$a[1]', '$a[2]', '$a[3]', '$a[4]', '$a[5]', '$a[6]', '$a[7]', '$a[8]', '$a[9]', '$a[10]', '$a[11]', '$a[12]', '$a[13]', '$a[14]')"; 
    $result = mysql_query($sql); 
     
   if(!$result); 
       echo mysql_error() . "\n";     


echo 'Database update completed.'; 
*/

function find_category($xml

    foreach(
$xml->achievement as $ach) { 
        if(
$ach['id'] == 576
            return 
$ach
    } 



function 
check_achievement($achievement$num) { 
if(
$achievement ['dateCompleted'] != NULL)
        return 
1;
        else
    if(
$achievement->criteria[$num]['date'] != NULL
        return 
1
    else 
        return 
0


?>
mysql access is disabled until error is fixed,
the error i'm recieving is when i update the script it send me this
HTML Code:
#!/usr/bin/php 
Working...</br><br />
<b>Notice</b>:  Use of undefined constant achievements - assumed 'achievements' in <b>C:\wamp\www\ulduar.php</b> on line <b>65</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\wamp\www\ulduar.php</b> on line <b>144</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\wamp\www\ulduar.php</b> on line <b>144</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\wamp\www\ulduar.php</b> on line <b>144</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\wamp\www\ulduar.php</b> on line <b>144</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\wamp\www\ulduar.php</b> on line <b>144</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\wamp\www\ulduar.php</b> on line <b>144</b><br />
Updated: <b>Goll</b> 0-0-0-0-0-0</br><br />
and the same for ALL the other things its meant to list too

does anyone know how to rectify this error at all

any help is appreciated
thanks in advance

Talonos

Last edited by talonos : 07-04-2009 at 03:25 PM. Reason: typo
talonos is offline  
Reply With Quote