Я бы предложил использовать cURL для извлечения удаленных данных.Вы можете сделать это:
$urls = [
"https://www.url1.com",
"https://www.url2.com",
"https://www.url3.com",
"https://www.url4.com",
"https://www.url5.com"
];
$decoded = array_map("loadJSON", $urls);
if (is_array($decoded[0])) {
foreach ($decoded[0] as $key => $value) {
if (is_array($value) && isset($value['price'])) {
$price = $value['price'];
echo '<span><b>' . $price . '</b><span>';
}
}
}
/**
* Downloads a JSON file from a URL and returns its decoded content
*/
function loadJSON($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // If your server does not have SSL
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // Follow redirections
curl_setopt($ch, CURLOPT_MAXREDIRS, 10); // 10 max redirections
$content = curl_exec($ch);
curl_close($ch);
$res = json_decode($content, true);
return $res;
}