I'm messing with the teamsnap API which uses Collection + JSON which seems to be making it a bit more difficult to extract specific data (at least for me).
What I need to do is get each member id so I can loop through those to then get a JSON response for each member's info. So far I am working on the first step.
Here is my code so far:
<?php
$url = "https://api.teamsnap.com/v3/members/search?team_id=TEAMID";
$access_key = 'TOKEN';
$request = curl_init( $url );
curl_setopt( $request, CURLOPT_HTTPHEADER, array( 'Authorization: Bearer ' . $access_key ) );
$response = (string)curl_exec( $request );
curl_close($request);
$result = json_decode($response, true);
foreach ($result as $r) {
echo $r['id'];
}
?>
UPDATE: I used print_r without json_decode and went line by line through thousands of lines of resposne to see how exactly the information I actually want is coming back. This is a bit the relevant portion. Sorry to have led you on a wild goose chase, but the response is quite complicated when it comes back and half of it is examples of how data COULD be returned....
{
"collection":{
"items":[
{
"href":"https://api.teamsnap.com/v3/members/MEMBERID",
"data":[
"name":"id",
"value":MEMBERID
},
{
"name":"type",
"value":"member"
},
{
"name":"address_city",
"value":""
},
{
"name":"address_state",
"value":""
},
{
"name":"address_street1",
"value":""
},
{
"name":"address_street2",
"value":null
},
{
"name":"address_zip",
"value":""
},