My code is now, I've made loads of changes
$query = '
query{
boards (ids: 1745132529){
columns {
id
title
type
}
}
}
';
$data = @file_get_contents($apiUrl, false, stream_context_create([
'http' => [
'method' => 'POST',
'header' => $headers,
'content' => json_encode(['query' => $query]),
]
]));
$responseContent = json_decode($data, true);
$res = (array_values($responseContent));
foreach ($res[0]["boards"][0]["columns"]as $key => $val) {
if(is_array($val)) {
echo "$key:\n<br>";
} else {
echo "$key => $val\n<br>";
}
}
echo "<br><br>Ref: " . $res[0]["boards"][0]["columns"][2]["title"] . "<br><br>";
the output is now: 0: 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
Ref: Client
if I try foreach ($res[0]["boards"][0]["columns"][0]["title"] as $key => $val) {
then I get just a blank output but
$res[0]["boards"][0]["columns"][1]["title"]
works if I just echo it.
How can I get all the values in my foreach - so I can get Name, Subitems, Client showing?
"; } else { echo "$key => $val\n
"; } }` – TridentMarketingUK Apr 26 '22 at 16:26