Evenin all, I'm slamming my head against a wall at the moment. I've been trying to call up items from within a json decoded array. The first tier, fine, second tier I just cant figure it out, I've tried all sorts and searched through the forums looking for a similar answer.
The output
object(stdClass)#1 (3) {
["players"]=>
array(1) {
[0]=>
object(stdClass)#2 (15) {
["name"]=>
string(10) "Deividas20"
["rank"]=>
int(18)
["rank_name"]=>
string(19) "MASTER SERGEANT III"
["veteran"]=>
int(1)
["score"]=>
int(311621)
["level"]=>
int(169)
["kills"]=>
int(1223)
["deaths"]=>
int(1199)
["time"]=>
float(100363.36)
["elo"]=>
float(15.545)
["form"]=>
string(2) "-1"
["date_lastupdate"]=>
string(25) "2010-03-23T08:22:38+01:00"
["count_updates"]=>
int(3)
["general"]=>
object(stdClass)#3 (28) {
["accuracy"]=>
float(0.785)
["dogr"]=>
int(107)
["dogt"]=>
int(77)
["elo0"]=>
float(73.663)
["elo1"]=>
float(71.044)
["games"]=>
int(111)
["goldedition"]=>
int(0)
["losses"]=>
int(56)
["sc_assault"]=>
int(64977)
["sc_award"]=>
int(176090)
["sc_bonus"]=>
int(19581)
["sc_demo"]=>
int(8238)
["sc_general"]=>
int(78540)
["sc_objective"]=>
int(13930)
["sc_recon"]=>
int(17759)
["sc_squad"]=>
int(18900)
["sc_support"]=>
int(29147)
["sc_team"]=>
int(11630)
["sc_vehicle"]=>
int(15410)
["slevel"]=>
int(0)
["spm"]=>
int(0)
["spm0"]=>
int(0)
["spm1"]=>
int(0)
["srank"]=>
int(0)
["sveteran"]=>
int(0)
["teamkills"]=>
int(0)
["udogt"]=>
int(0)
["wins"]=>
int(55)
}
["queue"]=>
bool(false)
}
}
["requested"]=>
int(1)
["found"]=>
int(1)
}
As soon as I try and pull anything out of general I just get blanks or "cannot us as object"
this is where i'm at right now
$data = json_decode($data);
//Get basic player info into useable bits
foreach ( $data->players as $player ) {
$name = "{$player->name}";
$rank_title = "{$player->rank_name}";
$kills = "{$player->kills}";
$deaths = "{$player->deaths}";
$score = "{$player->score}";
//Dig deeper!
$dogtags = "{$player->general->dogr}";
} // Close Foreach
$dogtags = "{$player->general->dogr}";
is what i've left it at for now. I know there's something im forgetting and it's probably staring me in the face! Just need someone to slap me across the chops to wake me up :quiet: