Php döngü ile Yardım

0 Cevap php

i nesnelerin bu dizi veri ayıklamak gerekir

{
    "data": [
        {
            "id": "136104923104306",
            "from": {
                "name": "GetWith.It",
                "category": "Website",
                "id": "136132969751208"
            },
            "message": "Do u know y **LOVE IS BLIND**\nbcoz..\n''ur mom started to love u before seeing ur face''....!",
            "updated_time": "2010-10-05T13:41:42+0000",
            "comments": {
                "data": [
                    {
                        "id": "136104923104306_1075253",
                        "from": {
                            "name": "Hressence Ec",
                            "id": "1464305271"
                        },
                        "message": "this I would agree..love is surely blind..",
                        "created_time": "2010-10-12T01:40:47+0000",
                    }
                ]
            }
        }

Benim geçerli kod:

$data=json_decode(file_get_contents('https://myurl/where/this/data/is'));
foreach($data as $dts){
echo "$dts->message";
};

i need to extract the comments .. and when i try

foreach($data->comments->data as $dts){
echo "$dts->message";
};

it returns null! help please

0 Cevap