I have this code, but the file_get_contents does not work correctly.
$html = file_get_contents('https://www.instagram.com/');
$dom = new domDocument();
$dom->loadHTML($html);
$dom->preserveWhiteSpace = false;
$images = $dom->getElementsByTagName('img');
foreach ($images as $image) {
$img_id = $image->getAttribute('id');
if($img_id == 'hi_2') {
echo $image->getAttribute('src');
}
}
Thanks for the help!