Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3613376
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:06:59+00:00 2026-05-18T22:06:59+00:00

i need to extract data from this array of objects { data: [ {

  • 0

i need to extract data from this array of objects

{
    "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",
                    }
                ]
            }
        }

My current code:

$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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T22:07:00+00:00Added an answer on May 18, 2026 at 10:07 pm

    Your $data is actually an object with a data property that is an array containing another object with the comments object you are looking for. So:

    foreach ($data->data as $item) {
        foreach ($item->comments->data as $comment) {
            echo $comment->message;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to extract data from a .mpp file on the network and combine
Sometimes I need to quickly extract some arbitrary data from XML files to put
I need to extract data from a source that presents it in one of
I've got two tables from which I need to extract information, but the data
I'm accessing some website and I need to extract some data. To be more
I need to be able to extract and transform data from a data source
I've a document from which I need to extract some data. Document contain strings
I am trying to extract data from this String: Hello there. Blah blahblah blah
I need to periodically download, extract and save the contents of http://data.dot.state.mn.us/dds/det_sample.xml.gz to disk.
I need to extract and decode barcodes and text from images. Is there any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.