far2slow Posted July 20, 2011 Share Posted July 20, 2011 do i need the json in the array for this to call each member or will it call it for each one ? if so how i dont think the line 'vbgtxyrr'=> $profile['id_member'] . $row['gamer_xbgt'], is right yet // Looping through the members. while ($profile = $smcFunc['db_fetch_assoc']($query_members)) { $context['display_groups'][$row['place']][$row['id_group']]['members'][$type][] = array( 'id' => $profile['id_member'], 'group_id' => $profile['id_group'], 'name' => '<span style="color: ' . $row['online_color'] . ';">' . $profile['real_name'] . '</span>', 'colorless_name' => $profile['real_name'], 'vbgtxyrr'=> $profile['id_member'] . $row['gamer_xbgt'], 'href' => $scripturl . '?action=profile;u=' . $profile['id_member'], 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '"><span style="color: ' . $row['online_color'] . ';">' . $profile['real_name'] . '</span></a>', 'title' => $profile['usertitle'], 'online' => array( 'label' => $txt[$profile['is_online'] ? 'online' : 'offline'], $txt[$profile['is_online'] ? 'online' : 'offline'] . '</a>', 'image_href' => $settings['images_url'] . '/' . ($profile['is_online'] ? 'useron' : 'useroff') . '.gif', ), ); } $smcFunc['db_free_result']($query_members); } $smcFunc['db_free_result']($request); $gamertag = 'vbgtxyrr'; $url = "http://www.oldgamerz.co.uk/xboxapi/xboxapi.php?gamertag=".urlencode($gamertag); $output = file_get_contents($url); $json = json_decode(utf8_encode($output), true); if($json === null) die("Error parsing JSON response (error #".json_last_error().")."); $xboxonline = $json['response'][0]['user']['is_online']; $xboxonline_status = $json['response'][0]['user']['online_status']; Link to comment https://forums.phpfreaks.com/topic/242481-do-i-have-to-have-the-json-in-the-array/ Share on other sites More sharing options...
far2slow Posted July 21, 2011 Author Share Posted July 21, 2011 any help with this? $gamertag = 'vbgtxyrr'; $url = "http://www.oldgamerz.co.uk/xboxapi/xboxapi.php?gamertag=".urlencode($gamertag); $output = file_get_contents($url); $json = json_decode(utf8_encode($output), true); if($json === null) die("Error parsing JSON response (error #".json_last_error().")."); $xboxonline = $json['response'][0]['user']['is_online']; $xboxonline_status = $json['response'][0]['user']['online_status']; is the the json // Looping through the members. while ($profile = $smcFunc['db_fetch_assoc']($query_members)) { $context['display_groups'][$row['place']][$row['id_group']]['members'][$type][] = array( 'id' => $profile['id_member'], 'group_id' => $profile['id_group'], 'name' => '<span style="color: ' . $row['online_color'] . ';">' . $profile['real_name'] . '</span>', 'colorless_name' => $profile['real_name'], 'vbgtxyrr'=> $profile['id_member'] . $row['gamer_xbgt'], 'href' => $scripturl . '?action=profile;u=' . $profile['id_member'], 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '"><span style="color: ' . $row['online_color'] . ';">' . $profile['real_name'] . '</span></a>', 'title' => $profile['usertitle'], 'online' => array( 'label' => $txt[$profile['is_online'] ? 'online' : 'offline'], $txt[$profile['is_online'] ? 'online' : 'offline'] . '</a>', 'image_href' => $settings['images_url'] . '/' . ($profile['is_online'] ? 'useron' : 'useroff') . '.gif', ), ); } this loops through the mebers i have called from the database so how can i do it so i can loop each member through the json Link to comment https://forums.phpfreaks.com/topic/242481-do-i-have-to-have-the-json-in-the-array/#findComment-1245511 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.