I try to parse json variables with php codes. Problem is some of array keys contain changeable values for each iteration. By the way this is not a duplicate question, there is nothing like json parsing with changeable variables. Here is my json example and php codes and also output;
{
"link":"",
"host":"stream",
"filename":"Rock Ballads The Best Of 70-90's",
"icon":"https:\/\/i.ytimg.com\/vi\/JN80ayCfmW0\/hqdefault.jpg",
"streaming":{
"audio track in mp3 (54.54MB)":"http:\/\/server.example.parsing.com\/str\/wlqcjv8246\/Rock+Ballads+The+Best+Of+70-90%26%23039%3Bs%28p%29.mp3",
"360p video in mp4 (80.04MB)":"http:\/\/server.example.parsing.com\/str\/wlqcjyfc33\/Rock+Ballads+The+Best+Of+70-90%26%23039%3Bs%28480p%29.mp4",
"240p video in mp4 (76.55MB)":"http:\/\/server.example.parsing.com\/str\/wlqck18b72\/Rock+Ballads+The+Best+Of+70-90%26%23039%3Bs%28240p%29.mp4",
"144p video in mp4 (71.09MB)":"http:\/\/server.example.parsing.com\/str\/wlqck4e410\/Rock+Ballads+The+Best+Of+70-90%26%23039%3Bs%28144p%29.mp4"
},
"nb":0,
"error":"",
"paws":false
}
and this is the php code that I use;
if($host=="www.youtube.com"){
$decodeProcess = json_decode($output,true);
echo ($decodeProcess['filename']);
echo ($decodeProcess['icon']);
echo ($decodeProcess['streaming']['audio track in mp3 (54.54MB)']);
}
In this case filename and icon works well but "audio track in mp3 (54.54MB)" or "144p video in mp4 (71.09MB)" is problem for me to parse because everytime the file size changes. What can I do?