$url = "www.test.com"
$json = file_get_contents($url);
$data = json_decode($json);
foreach($data as $mydata) {
$id = $mydata->id;
$url2 = "www.test.com/$id";
$json2 = file_get_contents($url2);
$data2 = json_decode($json2);
var_dump($data2); // seems to always be null?? :(
foreach($data2 as $mydata2) {
.............
}
}
the error I get is Warning: Invalid argument supplied for foreach() which is because data2 is not an array....
Guessing I can't do file_get_contents() stacked like I am. Is there a way around this?