I have a problem that I can not solve. JQuery works with getJSON, php does not work with foreach. The error I get in PHP:
Notice: Trying to get property of non-object in C:\xampp\htdocs\plreserv\index.php on line 14 Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\plreserv\index.php on line 14
JSON output from the service:
{
dataList: [
{
Date:'11.08.2017',
Com:'Spr',
BlsId:'5',
Type:'break',
TypeCheck:'0,5',
perma:'Normal',
CommaDetail:'0,,,particle,0,,,7',
Pom:[
{
Num:'1',
status:'1',
val:'37349',
lang:'tr'
},
{
Num:'2',
status:'1',
val:'37350',
lang:'ru'
}
]
}
]
}
My php code:
$file = file_get_contents(url);
$json = json_decode($file);
foreach($json as $data):
// code
endforeach;
There are 18 pages like this and none of them work in PHP. This is the error I get from the JSON viewer:
I'm sorry for my bad english. Thanks.