Skip to content
Advertisement

Get JSON value which change everytime using php

I have a JSON file

JavaScript

Now the value 4d7cc5ec-2aef-48ec-9ebf-f811d4c77a5d keeps changing every time the page is loaded. And I want to grab the value of link

My code is

JavaScript

But the problem is 4d7cc5ec-2aef-48ec-9ebf-f811d4c77a5d keeps changing every time. How do I then get the value of link using PHP?

Advertisement

Answer

Use array_column() as well as true as a second parameter to json_decode()

JavaScript

sample output: https://3v4l.org/oSQvo

Note: In case files contains multiple dynamic values then $link will give you array of all links. you can apply foreach() to iterate and get individual links

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement