Jump to content

do i have to have the json in the array ?


far2slow

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.