JavaScript is required to use Bungie.net

Group Avatar

BungieNetPlatform

"Updates, discussions, and documentation of the BungieNetPlatform API."

Запрос на вступление
  • Основные цели

    Updates, discussions, and documentation of the BungieNetPlatform API.

  • Участие

    3262 Участники
    Общее количество пользователей, вступивших в эту группу
    11 Стаж группы
    Срок активности этой группы (в годах)
  • Администраторы

  • Отмечено

впервые опубликовано в:BungieNetPlatform
Изменено (Nova Bomb Ninja): 12/14/2015 11:55:43 PM
3

Moving beyond the Gjallarhorn example and into clan rosters

Many thanks to VThornheart for pointing me in the right direction in getting started with PHP and web services and also to the many many people who have contributed to the BungieNetPlatform Wiki. I promised I would report back on progress and I feel pretty comfortable with the basics of PHP and API calls (score!) but I've reached my limits and I'm having trouble finding advice that works for the next step I'd like to take.I'd like to pull names from a clan roster and display them as a list. If I need to take this post to StackOverflow or a different place please let me know but I thought this might be the best place to get relevant advice. The call I'm making for my clan (DoD Warlords) is from URL https://bungie.net/Platform/Group/1179713/Members/?lc=en&fmt=true¤tPage=1&platformType=1. This returns the first page of results. I'll figure out the code to get the other pages in the future but for now I'm just looking to pull the first page of names. Using the Simple REST Client Chrome extension, I know the JSON object that is returned looks like this (shortened): [spoiler][quote]{"Response":{"results":[{"user":{"membershipId":"6343960","uniqueName":"6343960","displayName":"Der Madraider","profilePicture":70585,"profileTheme":111,"userTitle":0,"successMessageFlags":"40","isDeleted":false,"about":""He who fights with monsters should look to it that he himself does not become a monster. And when you gaze long into an abyss the abyss also gazes into you." -- Friedrich Nietzsche, Beyond Good and Evil, Aphorism 146 (1886)","firstAccess":"2014-09-11T18:33:24.093Z","lastUpdate":"2015-09-16T02:04:54.071Z","xboxDisplayName":"Der Madraider","showActivity":true,"followerCount":138,"followingUserCount":152,"locale":"en","localeInheritDefault":true,"showGroupMessaging":true,"profilePicturePath":"/img/profile/avatars/e2015_13.jpg","profileThemeName":"bungie_day15_21","userTitleDisplay":"Newbie","statusText":"I like spaghetti!","statusDate":"2015-08-15T19:31:52.672Z"},"hasPendingApplication":false,"hasRated":false,"approvalDate":"2015-08-15T18:53:35.506Z","approvedByMembershipId":"6343960","rating":0,"groupId":"1179713","membershipType":254,"membershipId":"6343960","isMember":true,"memberType":2,"isOriginalFounder":true},{"user":{"membershipId":"4479502","uniqueName":"4479502","displayName":"TeamEllis","profilePicture":70536,"profileTheme":66,"userTitle":0,"successMessageFlags":"48","isDeleted":false,"about":"","firstAccess":"2014-05-20T23:14:47.871Z","lastUpdate":"2015-10-10T07:20:29.906Z","xboxDisplayName":"Team Ellis 07","showActivity":true,"followerCount":104,"followingUserCount":113,"locale":"en","localeInheritDefault":false,"showGroupMessaging":true,"profilePicturePath":"/img/profile/avatars/bungieday_14.jpg","profileThemeName":"Destiny1","userTitleDisplay":"Newbie","statusText":"ad022677","statusDate":"2015-10-10T07:20:29.906Z"},"hasPendingApplication":false,"hasRated":false,"approvalDate":"2015-09-01T02:28:03.313Z","approvedByMembershipId":"6343960","rating":0,"groupId":"1179713","membershipType":254,"membershipId":"4479502","isMember":true,"memberType":0,"isOriginalFounder":false},{"user":{"membershipId":"34912","uniqueName":"Camjay","displayName":"Camjay","profilePicture":70516,"profileTheme":21,"userTitle":0,"successMessageFlags":"32","isDeleted":false,"about":"","firstAccess":"2006-12-21T23:30:24.517Z","lastUpdate":"2015-07-29T21:35:32.174Z","xboxDisplayName":"Camjay","showActivity":true,"followerCount":129,"followingUserCount":347,"locale":"en","localeInheritDefault":true,"showGroupMessaging":true,"profilePicturePath":"/img/profile/avatars/Destiny25.jpg","profileThemeName":"septagon","userTitleDisplay":"Newbie","statusText":"","statusDate":"0001-01-01T00:00:00Z"},"hasPendingApplication":false,"hasRated":false,"approvalDate":"2015-08-16T03:27:37.579Z","approvedByMembershipId":"34912","rating":0,"groupId":"1179713","membershipType":254,"membershipId":"34912","isMember":true,"memberType":0,"isOriginalFounder":false},,....}}[/quote][/spoiler] What I would like to do is get the usernames (displayName) from this list. Really, I'd like to be able to output anything but haven't had any luck. Here's the code I'm using but without an output line (it's the Gjallarhorn example code with a different URL. I left out the output line because nothing I'm doing works.): [spoiler] [quote]<?php $apiKey = 'xxxxxxxxxxx' '; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://bungie.net/Platform/Group/1179713/Members/?lc=en&fmt=true¤tPage=1&platformType=1'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-API-Key: ' . $apiKey)); $json = json_decode(curl_init($ch)); // TODO: Output usernames (displayName). ?>[/quote][/spoiler] I've searched around StackOverflow for similar problems and general Google searches but nothing I could find works for this problem. I'd like to know more about how to treat these JSON objects, especially to pull a request for a clan roster but also in general how to work with them. Thanks for reading my request and thanks in advance for any nudges in the right direction.

Публикуется на языке:

 

Играйте достойно. Потратьте минутку на ознакомление с нашими правилами, прежде чем отправлять вашу запись. Отмена Изменить Создать боевую группу Опубликовать

У вас нет прав для просмотра этих материалов.
;
preload icon
preload icon
preload icon