10
Фев
2016

Проверить наличие игры

Делаю запрос http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=****key****&steamid=76561198136664210&format=json делаю json_decode() и получаю

Array
(
    [response] => Array
        (
            [game_count] => 42
            [games] => Array
                (
                    [0] => Array
                        (
                            [appid] => 70110
                            [playtime_forever] => 124
                        )

                    [1] => Array
                        (
                            [appid] => 70000
                            [playtime_forever] => 519
                        )

                    [2] => Array
                        (
                            [appid] => 105600
                            [playtime_forever] => 369
                        )

                    [3] => Array
                        (
                            [appid] => 204340
                            [playtime_2weeks] => 260
                            [playtime_forever] => 4528
                        )

                    [4] => Array
                        (
                            [appid] => 204360
                            [playtime_forever] => 189
                        )

                    [5] => Array
                        (
                            [appid] => 1930
                            [playtime_forever] => 439
                        )

                    [6] => Array
                        (
                            [appid] => 232770
                            [playtime_forever] => 96
                        )

                    [7] => Array
                        (
                            [appid] => 239450
                            [playtime_forever] => 55
                        )

                    [8] => Array
                        (
                            [appid] => 243780
                            [playtime_forever] => 382
                        )

                    [9] => Array
                        (
                            [appid] => 251690
                            [playtime_forever] => 518
                        )

                    [10] => Array
                        (
                            [appid] => 253900
                            [playtime_forever] => 277
                        )

                    [11] => Array
                        (
                            [appid] => 253980
                            [playtime_forever] => 393
                        )

                    [12] => Array
                        (
                            [appid] => 254000
                            [playtime_forever] => 0
                        )

                    [13] => Array
                        (
                            [appid] => 254020
                            [playtime_forever] => 0
                        )

                    [14] => Array
                        (
                            [appid] => 254040
                            [playtime_forever] => 0
                        )

                    [15] => Array
                        (
                            [appid] => 254060
                            [playtime_forever] => 0
                        )

                    [16] => Array
                        (
                            [appid] => 259280
                            [playtime_forever] => 0
                        )

                    [17] => Array
                        (
                            [appid] => 275490
                            [playtime_forever] => 638
                        )

                    [18] => Array
                        (
                            [appid] => 278460
                            [playtime_forever] => 122
                        )

                    [19] => Array
                        (
                            [appid] => 283370
                            [playtime_forever] => 0
                        )

                    [20] => Array
                        (
                            [appid] => 286360
                            [playtime_forever] => 0
                        )

                    [21] => Array
                        (
                            [appid] => 287100
                            [playtime_forever] => 0
                        )

                    [22] => Array
                        (
                            [appid] => 292380
                            [playtime_forever] => 467
                        )

                    [23] => Array
                        (
                            [appid] => 292390
                            [playtime_forever] => 0
                        )

                    [24] => Array
                        (
                            [appid] => 295930
                            [playtime_forever] => 479
                        )

                    [25] => Array
                        (
                            [appid] => 41050
                            [playtime_forever] => 0
                        )

                    [26] => Array
                        (
                            [appid] => 41060
                            [playtime_forever] => 0
                        )

                    [27] => Array
                        (
                            [appid] => 227780
                            [playtime_forever] => 211
                        )

                    [28] => Array
                        (
                            [appid] => 299260
                            [playtime_forever] => 0
                        )

                    [29] => Array
                        (
                            [appid] => 8980
                            [playtime_forever] => 0
                        )

                    [30] => Array
                        (
                            [appid] => 301700
                            [playtime_forever] => 0
                        )

                    [31] => Array
                        (
                            [appid] => 301750
                            [playtime_forever] => 155
                        )

                    [32] => Array
                        (
                            [appid] => 303390
                            [playtime_forever] => 72
                        )

                    [33] => Array
                        (
                            [appid] => 304050
                            [playtime_forever] => 0
                        )

                    [34] => Array
                        (
                            [appid] => 304930
                            [playtime_forever] => 245
                        )

                    [35] => Array
                        (
                            [appid] => 227940
                            [playtime_2weeks] => 31
                            [playtime_forever] => 31
                        )

                    [36] => Array
                        (
                            [appid] => 10
                            [playtime_forever] => 98
                        )

                    [37] => Array
                        (
                            [appid] => 80
                            [playtime_forever] => 0
                        )

                    [38] => Array
                        (
                            [appid] => 100
                            [playtime_forever] => 0
                        )

                    [39] => Array
                        (
                            [appid] => 240
                            [playtime_forever] => 0
                        )

                    [40] => Array
                        (
                            [appid] => 730
                            [playtime_2weeks] => 2269
                            [playtime_forever] => 58557
                        )

                    [41] => Array
                        (
                            [appid] => 410210
                            [playtime_forever] => 0
                        )

                )

        )

)

Нужно узнать есть ли тут игра с appid = 730, одним словом проверить наличие CS:GO, есть идея перебирать в цикле но хотелось бы знать есть ли вариант лучше?

Источник: https://ru.stackoverflow.com/questions/491109/%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%B8%D1%82%D1%8C-%D0%BD%D0%B0%D0%BB%D0%B8%D1%87%D0%B8%D0%B5-%D0%B8%D0%B3%D1%80%D1%8B

Share

Тебе может это понравится...