0

Как вытянуть средствами PHP данные по matchid к примеру 61850081496580 Есть JSON

{
    "MatchList": [{
        "id": "0",
        "matchid": "61850081496580",
        "live": true,
        "type": "football",
        "date": "01-24-19",
        "dateString": "09:31",
        "title": "Paro - Transport ",
        "titleseo": "paro-transport",
        "embed": "https://www.livebet777.co",
        "FrameLink": "https://www.boostreaming.ooo/live/paro-transport"
    }, {
        "id": "1",
        "matchid": "95219091403183065231",
        "live": true,
        "type": "tennis",
        "date": "01-24-19",
        "dateString": "11:15",
        "title": "Sebastian  - Marc Polma",
        "titleseo": "sebastian-marc-polma",
        "embed": "https://www.livebet777.co",
        "FrameLink": "https://www.boostreaming.ooo/live/sebastian-marc-polma"
    }, {
        "id": "2",
        "matchid": "905614590008161520414",
        "live": true,
        "type": "tennis",
        "date": "01-24-19",
        "dateString": "11:30",
        "title": "Stefanos T - Rafael Nad",
        "titleseo": "stefanos-t-rafael-nad",
        "embed": "https://www.livebet777.co",
        "FrameLink": "https://www.boostreaming.ooo/live/stefanos-t-rafael-nad"
    }, {
        "id": "3",
        "matchid": "314935035807952144906",
        "live": true,
        "type": "tennis",
        "date": "01-24-19",
        "dateString": "11:30",
        "title": "Maxime Mor - Giovanni F",
        "titleseo": "maxime-mor-giovanni-f",
        "embed": "https://www.livebet777.co",
        "FrameLink": "https://www.boostreaming.ooo/live/maxime-mor-giovanni-f"
    }, {
        "id": "4",
        "matchid": "454499019603120580081",
        "live": true,
        "type": "tennis",
        "date": "01-24-19",
        "dateString": "11:45",
        "title": "Dennis Usp - Walter Tru",
        "titleseo": "dennis-usp-walter-tru",
        "embed": "https://www.livebet777.co",
        "FrameLink": "https://www.boostreaming.ooo/live/dennis-usp-walter-tru"
    }, {
        "id": "5",
        "matchid": "212245000106520318094",
        "live": true,
        "type": "tennis",
        "date": "01-24-19",
        "dateString": "11:45",
        "title": "Vullnet Ta - Pol Martin",
        "titleseo": "vullnet-ta-pol-martin",
        "embed": "https://www.livebet777.co",
        "FrameLink": "https://www.boostreaming.ooo/live/vullnet-ta-pol-martin"
    }, {
        "id": "6",
        "matchid": "556695890309283941065",
        "live": true,
        "type": "tennis",
        "date": "01-24-19",
        "dateString": "11:45",
        "title": "Zeppieri/M - Svrcina/Fo",
        "titleseo": "zeppieri-m-svrcina-fo",
        "embed": "https://www.livebet777.co",
        "FrameLink": "https://www.boostreaming.ooo/live/zeppieri-m-svrcina-fo"
    }, ],
    "Statue": true
}
1
  • Используйте json_decode, далее у Вас на выходе будет массив, в нем и ищите 24 янв 2019 в 9:59

1 ответ 1

1

Не проверял, но как-то так:

$data = json_decode($jsonString);
function ($data, $matchId) {
    foreach ($data['MatchList'] as $item) {
        if ((int)$item['matchid'] === $matchId) {
            return $item;
        }
    }
    return null;
}
2
  • Не получается у меня
    – Erise Wdg
    24 янв 2019 в 10:10
  • Что конкретно не получается? 24 янв 2019 в 10:32

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.