Good all the time of day!
Tell me, how can I access the array even one level deeper?
There is $data['Stats'] , it has 1 more array with the same name Stats :

 { "platformId": 4, "AccountId": "account.0993d6055496416f9e5710016a061b8d", "Avatar": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/37/374526a1a62802567734c74760c2d890e89c6a3b.jpg", "selectedRegion": "agg", "defaultSeason": "2017-pre4", "seasonDisplay": "Early Access Season #4", "LastUpdated": "2017-09-30T00:47:34.7304316Z", "PlayerName": "Lidman", "PubgTrackerId": 392412, "Stats": [ { "Region": "eu", "Season": "2017-pre2", "Match": "solo", "Stats": [ { "label": "K/D Ratio", "field": "KillDeathRatio", "category": "Performance", "ValueInt": null, "ValueDec": 1.33, "value": "1.33", "rank": null, "percentile": null, "displayValue": "1.33" }, 

Here is the code itself:

 <?php $curl = curl_init(); $a = $_POST['pubg-nickname']; curl_setopt_array($curl, array( CURLOPT_URL => "https://123.com/api/profile/pc/{$a}", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array( "cache-control: no-cache", "trn-api-key: 1111" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); $data = json_decode($response, true); $foto = $data['Avatar']; echo '<center><table class="table table-striped table-bordered table-responsive">'; foreach ($data['Stats'] as $key => $value) { echo "<tr class=".warning."> <td>".$value['Region']."</td> <td>".$value['Season']."</td> <td>".$value['Kills']."</td> <td>".$value['Match']."</td> </tr>"; } echo "</center></table>"; ?> 

    1 answer 1

    These are bases, to refer to the matrix, it is necessary as to the usual element of the array, and to its element, as to the element of the element.

     $arr['elem'] \\это обращения к элементу в массиве $arr['arr'] \\это обращения к элементу массива, который является массивом, но очень часто, это не имеет смысла. $arr['arr']['elem'] \\ это обращения к элементу массива, который находиться в изначальном массиве, проще говоря к матрице. 

    This is a mat part, it's bad that you do not know it, but it already works with the cURL component, even if the code is not yours.

    PS in your case, the treatment looks like this

     $data['Stats'][0]['Stats'][0] 
    • I tried to iterate over the array like this, but in the end I don’t get any data at all. foreach ($data['Stats']['Stats'] as $key => $value) { echo "<tr class=".warning."> <td>".$value['Region']."</td> <td>".$value['Season']."</td> <td>".$value['Kills']."</td> <td>".$value['label']."</td> </tr>"; } foreach ($data['Stats']['Stats'] as $key => $value) { echo "<tr class=".warning."> <td>".$value['Region']."</td> <td>".$value['Season']."</td> <td>".$value['Kills']."</td> <td>".$value['label']."</td> </tr>"; } I also tried <td> ". $ Value ['Stats'] ['label']." </ Td > - heymukki
    • This happens simply because in addition to the Stats that still contain Stats, there is also an array, the solvent must also be addressed to the zero element. I edited the answer, read. - Evgeny Ivanov
    • The same thing - does not receive any information. Could you edit in the code? Maybe I'm doing something wrong - heymukki