-2

I wanna to loop to get all articles nested key and values like title , image url... etc,

here is the Json string

{"status":"ok","totalResults":394877,"articles":[{"source":{"id":"engadget","name":"Engadget"},"author":"https://www.engadget.com/about/editors/kris-holt","title":"Uber, PayPal and Walgreens set up a Vaccine Access Fund","description":"Anyone can donate and help to cover the cost of rides to COVID-19 vaccination sites.","url":"https://www.engadget.com/uber-paypal-walgreens-vaccine-access-fund-donations-150056875.html","urlToImage":"https://s.yimg.com/os/creatr-uploaded-images/2021-04/6031a890-9b9d-11eb-93bf-f9d0aa515883","publishedAt":"2021-04-12T15:00:56Z","content":"Uber\r\n has teamed up with PayPal\r\n and Walgreens\r\n to create a Vaccine Access Fund\r\n with the aim of covering the cost of trips to COVID-19 vaccination sites, especially for people in underserved com… [+1471 chars]"},{"source":{"id":"engadget","name":"Engadget"},"author":"https://www.engadget.com/about/editors/jon-fingas","title":"Alexa can help you find a COVID-19 vaccination site","description":"Amazon Alexa now helps you find nearby COVID-19 vaccination sites, and call them if you have vaccine questions.","url":"https://www.engadget.com/amazon-alexa-covid-19-vaccination-site-151440856.html","urlToImage":"https://s.yimg.com/os/creatr-uploaded-images/2021-04/73830b10-a1e6-11eb-bdf2-57fabbd8c037","publishedAt":"2021-04-20T15:14:40Z","content":"Now that every adult in the US is eligible for a COVID-19 vaccine, Amazon wants to make it as simple as possible to get your shots. Alexa now helps you find vaccination sites just by saying "where ca… [+938 chars]"},{"source":{"id":"engadget","name":"Engadget"},"author":"https://www.engadget.com/about/editors/kris-holt","title":"You can now book a COVID-19 vaccine through Uber","description":"You'll also be able to reserve a rental car and have a valet drop it off..","url":"https://www.engadget.com/uber-walgreens-covid-19-vaccine-rental-car-valet-uber-eats-165251912.html","urlToImage":"https://s.yimg.com/os/creatr-uploaded-images/2021-04/c9dcd130-a83f-11eb-bff5-d77d7000f88b","publishedAt":"2021-04-28T16:52:51Z","content":"Uber\r\n and Walgreens have been working together on a COVID-19\r\n vaccination program for several months, and the latest step in their partnership should make it easier for you to get the vaccine. You … [+2591 chars]"},{"source":{"id":"wired","name":"Wired"},"author":"Angela Watercutter","title":"'The Handmaid's Tale' Hits Hard in Covid-Era America","description":"Hulu's adaptation of Margaret Atwood's book has always felt of-the-moment—now more than ever.","url":"https://www.wired.com/story/the-handmaids-tale-hits-hard-covid-era-america/","urlToImage":"https://media.wired.com/photos/608ada7e8abaca72c070695a/191:100/w_1280,c_limit/Culture_monitor_tht_403_sg-0007rt-1.jpg","publishedAt":"2021-04-30T13:00:00Z","content":"The Monitor is a weekly columndevoted to everything happening in the WIRED world of culture, from movies to memes, TV to Twitter.\r\nThe Handmaids Tales gift is prescience. From Margaret Atwoods 1985 b… [+3546 chars]"},{"source":{"id":"wired","name":"Wired"},"author":"Gregory Barber","title":"Variant Hunters Race to Find New Strains Where Testing Lags","description":"In countries without much sequencing, new versions of the Covid virus can go unnoticed. Scientists across Africa are collaborating to track them down.","url":"https://www.wired.com/story/variant-hunters-race-to-find-new-strains-where-testing-lags/","urlToImage":"https://media.wired.com/photos/606fbf39b5c90ecdb84fc7f2/191:100/w_1280,c_limit/Science-variants-1243363094.jpg","publishedAt":"2021-04-09T11:00:00Z","content":"In mid-February, three travelers were stopped at the airport in Luanda, Angola. Even during the pandemic, the country, a hub for the oil industry, had seen plenty of passengers from Europe and South … [+4242 chars]"},{"source":{"id":"wired","name":"Wired"},"author":"Maryn McKenna","title":"Covid Lockdowns Prevented Other Infections. Is That Good?","description":"The “hygiene hypothesis” says early contact with microbes trains our immune systems. But what happens after a year of distancing?","url":"https://www.wired.com/story/covid-lockdowns-prevented-other-infections-is-that-good/","urlToImage":"https://media.wired.com/photos/607f3a12a2b5c89083d5915e/191:100/w_1280,c_limit/Science_sickchild_1218888782.jpg","publishedAt":"2021-04-26T11:00:00Z","content":"The key finding in the study, though, wasnt that more people had allergies; that was an accepted observation already. It was who had them and who didnt. The author, immunologist David Strachan, repor… [+3721 chars]"},{"source":{"id":null,"name":"New York Times"},"author":"David Leonhardt","title":"Irrational Covid Fears","description":"Why do so many vaccinated people remain fearful? Listen to the professor’s story.","url":"https://www.nytimes.com/2021/04/19/briefing/european-soccer-league-mars-helicopter-navalny.html","urlToImage":"https://static01.nyt.com/images/2021/04/19/lens/19ambriefing-promo/19ambriefing-traffic-facebookJumbo.jpg","publishedAt":"2021-04-19T10:24:21Z","content":"To take just one example, majormediaoutlets trumpeted new government data last week showing that 5,800 fully vaccinated Americans had contracted Covid. That may sound like a big number, but it indica… [+1683 chars]"},{"source":{"id":"bbc-news","name":"BBC News"},"author":"https://www.facebook.com/bbcnews","title":"Covid: Perth ends lockdown after Covid cases contained","description":"A snap three-day lockdown was enforced after the state's first case of community transmission in a year.","url":"https://www.bbc.co.uk/news/world-australia-56883022","urlToImage":"https://ichef.bbci.co.uk/news/1024/branded_news/EB8B/production/_118199206_gettyimages-1314265709.jpg","publishedAt":"2021-04-26T06:41:41Z","content":"image captionResidents in the Western Australian capital were put into lockdown on Friday\r\nThe Australian city of Perth will end a snap three-day lockdown that began after a man contracted Covid in h… [+3503 chars]"},{"source":{"id":null,"name":"Lifehacker.com"},"author":"Aisha Jordan","title":"Get All This Free Stuff With Proof of Your COVID Vaccination","description":"So far, 23.6% of the U.S. population has been fully vaccinated, and businesses are giving people a bit of a nudge by offering free products and services to people who show proof of their COVID-19 vaccination. Here are a few perks of getting your jab taken car…","url":"https://lifehacker.com/get-all-this-free-stuff-with-proof-of-your-covid-vaccin-1846701977","urlToImage":"https://i.kinja-img.com/gawker-media/image/upload/c_fill,f_auto,fl_progressive,g_center,h_675,pg_1,q_80,w_1200/nps80rdmany8cpsus3fa.jpg","publishedAt":"2021-04-16T21:00:00Z","content":"So far, 23.6% of the U.S. population has been fully vaccinated, and businesses are giving people a bit of a nudge by offering free products and services to people who show proof of their COVID-19 vac… [+3179 chars]"},{"source":{"id":null,"name":"Lifehacker.com"},"author":"Beth Skwarecki","title":"What to Do If You Get a Bill for Your COVID-19 Vaccine","description":"COVID vaccines are free in the U.S. Period. The CDC has been extremely clear about that, but we’re still hearing occasional reports of people getting a bill for their vaccine, or being charged a fee for the service of “administering” that vaccine. In either c…","url":"https://vitals.lifehacker.com/what-to-do-if-you-receive-a-bill-for-your-covid-19-vacc-1846739444","urlToImage":"https://i.kinja-img.com/gawker-media/image/upload/c_fill,f_auto,fl_progressive,g_center,h_675,pg_1,q_80,w_1200/zff8xcy2ppquhltzkrd1.jpg","publishedAt":"2021-04-22T17:15:00Z","content":"COVID vaccines are free in the U.S. Period. The CDC has been extremely clear about that, but were still hearing occasional reports of people getting a bill for their vaccine, or being charged a fee f… [+2750 chars]"},{"source":{"id":null,"name":"Lifehacker.com"},"author":"Elizabeth Yuko","title":"How to Tell Someone You're Still Not Comfortable Going to Their Big Event During COVID","description":"Though it’s really difficult to look at a global pandemic that is responsible for more than 566,000 deaths in the United States alone and identify anything positive that has come from it, there have been a few aspects of the public health measures that some p…","url":"https://lifehacker.com/how-to-tell-someone-youre-still-not-comfortable-going-t-1846705212","urlToImage":"https://i.kinja-img.com/gawker-media/image/upload/c_fill,f_auto,fl_progressive,g_center,h_675,pg_1,q_80,w_1200/nv7byu8khhwhi4faibjg.jpg","publishedAt":"2021-04-18T13:30:00Z","content":"Though its really difficult to look at a global pandemic that is responsible for more than 566,000 deaths in the United States alone and identify anything positive that has come from it, there have b… [+3841 chars]"},{"source":{"id":null,"name":"Lifehacker.com"},"author":"A.A. Newton on Vitals, shared by A.A. Newton to Lifehacker","title":"How to Get Through Your COVID Shot If You Really Hate Needles","description":"If you’re one of the millions of adults who avoid needles at all costs, you might be straight-up dreading your first COVID vaccine. Unfortunately, the best plan of action is to get it over with. It won’t be fun or even painless, but with a little preparation,…","url":"https://vitals.lifehacker.com/how-to-get-through-your-covid-shot-if-you-really-hate-n-1846646055","urlToImage":"https://i.kinja-img.com/gawker-media/image/upload/c_fill,f_auto,fl_progressive,g_center,h_675,pg_1,q_80,w_1200/xvrrf9skjsk9yrb1z0bq.jpg","publishedAt":"2021-04-09T13:30:00Z","content":"If youre one of the millions of adults who avoid needles at all costs, you might be straight-up dreading your first COVID vaccine. Unfortunately, the best plan of action is to get it over with. It wo… [+2913 chars]"},{"source":{"id":"the-verge","name":"The Verge"},"author":"Mary Beth Griggs","title":"We’re on the knife’s edge of the pandemic","description":"In the US, great joy co-exists with deep worries about the current state of the COVID-19 pandemic, as vaccinations increase, and case counts rise.","url":"https://www.theverge.com/2021/4/3/22364637/pandemic-edge-fear-hope-vaccines-surge-antivirus-newsletter","urlToImage":"https://cdn.vox-cdn.com/thumbor/MnxxYSNK68UfpBoeAai-rBPZN2I=/0x434:6063x3608/fit-in/1200x630/cdn.vox-cdn.com/uploads/chorus_asset/file/22417342/1232071704.jpg","publishedAt":"2021-04-03T14:00:00Z","content":"Antivirus: a weekly digest of COVID-19 research and development\r\nA vaccine site that opened in Louisville, Kentucky on April 2, 2021, as cases rose in the state.\r\nPhoto by Jon Cherry/Getty Images\r\nTh… [+5496 chars]"},{"source":{"id":"the-verge","name":"The Verge"},"author":"Justine Calma","title":"CDC says fully vaccinated people can travel safely in the US","description":"The CDC issued new guidance to travelers who have been fully vaccinated. They can safely travel within the US without self-quarantining or taking COVID-19 tests.","url":"https://www.theverge.com/2021/4/2/22364102/cdc-fully-vaccinated-people-travel-guidelines","urlToImage":"https://cdn.vox-cdn.com/thumbor/m3E6tidHv5y77-JTz_Tb-qSMUhs=/0x359:5000x2977/fit-in/1200x630/cdn.vox-cdn.com/uploads/chorus_asset/file/22416352/1231950033.jpg","publishedAt":"2021-04-02T17:05:08Z","content":"Theyll still need to wear masks and physically distance from other travelers\r\nTravelers wearing protective masks walk past a sign pointing towards a Covid-19 testing location in Terminal 5 at John F.… [+2130 chars]"},{"source":{"id":"the-verge","name":"The Verge"},"author":"Nicole Wetsman","title":"How CO2 sensors might help us return to ‘normal’","description":"Monitoring carbon dioxide levels in indoor spaces can help track how well-ventilated they are. Improving ventilation can make rooms less risky while COVID-19 levels are high.","url":"https://www.theverge.com/2021/4/14/22382361/covid-carbon-dioxide-co2-ventilation-sensor-bars-restaurant","urlToImage":"https://cdn.vox-cdn.com/thumbor/lJnp4Qgm_AZEsa_zJ97taL1UFqQ=/0x146:2040x1214/fit-in/1200x630/cdn.vox-cdn.com/uploads/chorus_asset/file/22441605/CONTAINER.jpg","publishedAt":"2021-04-14T14:00:00Z","content":"They can help monitor ventilation\r\nOne of the things weve learned over the past year is to be wary of the air around us especially indoors. If other people are around, exhaling, theyre filling the sp… [+1097 chars]"},{"source":{"id":null,"name":"Gizmodo.com"},"author":"Ed Cara","title":"Covid-19 Booster Shots Likely Needed Within a Year, Top Biden Advisor Says","description":"Booster shots against the covid-19 coronavirus may become a regular necessity, according to recent comments from David Kessler, chief science officer for President Joe Biden’s covid-19 task force, as well as from Pfizer CEO Albert Bourla. Read more...","url":"https://gizmodo.com/covid-19-booster-shots-likely-needed-within-a-year-top-1846693414","urlToImage":"https://i.kinja-img.com/gawker-media/image/upload/c_fill,f_auto,fl_progressive,g_center,h_675,pg_1,q_80,w_1200/rcszgjxyoc8ehw9ezcl3.jpg","publishedAt":"2021-04-15T20:34:00Z","content":"Booster shots against the covid-19 coronavirus may become a regular necessity, according to recent comments from David Kessler, chief science officer for President Joe Bidens covid-19 task force, as … [+3561 chars]"},{"source":{"id":null,"name":"Gizmodo.com"},"author":"Ed Cara","title":"Don't Laminate Your Covid-19 Vax Card","description":"You’re fully vaccinated and you’ve got a little paper card to prove it. So what to do with this precious evidence of immunity? Tempting as it might be to laminate the card for posterity and protection, you probably shouldn’t—it may need an update soon.Read mo…","url":"https://gizmodo.com/dont-laminate-your-covid-19-vax-card-1846779969","urlToImage":"https://i.kinja-img.com/gawker-media/image/upload/c_fill,f_auto,fl_progressive,g_center,h_675,pg_1,q_80,w_1200/fasuzejotcrxydevgpjm.jpg","publishedAt":"2021-04-28T15:50:00Z","content":"Youre fully vaccinated and youve got a little paper card to prove it. So what to do with this precious evidence of immunity? Tempting as it might be to laminate the card for posterity and protection,… [+2843 chars]"},{"source":{"id":null,"name":"New York Times"},"author":"Rick Gladstone and Billie Sweeney","title":"Fire Strikes Covid Hospital Ward in India.","description":"The news compounded the sense of despair overwhelming the nation of 1.4 billion, now suffering the worst pandemic wave anywhere.","url":"https://www.nytimes.com/2021/04/30/world/india-covid-hospital-fire.html","urlToImage":"https://static01.nyt.com/newsgraphics/images/icons/defaultPromoCrop.png","publishedAt":"2021-04-30T23:22:15Z","content":"The second wave in India has crammed hospitals to unbearably full capacity, exhausted oxygen supplies and left desperate people dying in line waiting to see doctors. Mass cremations have been held ar… [+976 chars]"},{"source":{"id":null,"name":"Lifehacker.com"},"author":"Beth Skwarecki on Vitals, shared by Beth Skwarecki to Lifehacker","title":"How Much Should You Worry About That Post-Vaccine Rash?","description":"Having a sore arm after you get a vaccine is pretty common, but some people who get their first dose of a COVID vaccine have ended up with a red or itchy rash on their arm or, occasionally, their whole body. Fortunately, the rash goes away and tends not to co…","url":"https://vitals.lifehacker.com/how-much-should-you-worry-about-that-post-vaccine-rash-1846651586","urlToImage":"https://i.kinja-img.com/gawker-media/image/upload/c_fill,f_auto,fl_progressive,g_center,h_675,pg_1,q_80,w_1200/rgq8ushuktz9o9vhdnzw.jpg","publishedAt":"2021-04-09T17:30:00Z","content":"Having a sore arm after you get a vaccine is pretty common, but some people who get their first dose of a COVID vaccine have ended up with a red or itchy rash on their arm or, occasionally, their who… [+2695 chars]"},{"source":{"id":null,"name":"Lifehacker.com"},"author":"Elizabeth Yuko","title":"Use This Map to Find Which States Are Best for Remote Workers","description":"More than a year ago, many people became remote workers by default, thanks to the COVID-19 pandemic. It wasn’t necessarily something most people had looked into—it just happened. Prior to the pandemic, about 20% of people with jobs that could be performed rem…","url":"https://lifehacker.com/use-this-map-to-find-which-states-are-best-for-remote-w-1846656315","urlToImage":"https://i.kinja-img.com/gawker-media/image/upload/c_fill,f_auto,fl_progressive,g_center,h_675,pg_1,q_80,w_1200/y94rkomq2qmuay7wxhhz.jpg","publishedAt":"2021-04-10T13:30:00Z","content":"More than a year ago, many people became remote workers by default, thanks to the COVID-19 pandemic. It wasnt necessarily something most people had looked intoit just happened. Prior to the pandemic,… [+2086 chars]"}]}

Eric Online
  • 27
  • 1
  • 1
  • 7

1 Answers1

3

To use JSON inside PHP you first need to decode it using json_decode. By the looks of your JSON structure, you'll want it to be transformed into an associative array for easier access. Here's a quick demo.

$decoded = json_decode($json, true);

foreach ($decoded['articles'] as $article) {
    // echo $article['title'] . "\n";
}
Kim Hallberg
  • 1,165
  • 1
  • 9
  • 18