I'm trying to use the function file_get_contents($url) to scrape some content. but it doesn't return the right content. It just returns some scripts, I think they are responsible for location and language checking and then it fails and doesn't continue scraping the whole page
$url = 'https://shop.bitmain.com/';
$exists;
$url_headers = get_headers($url);
if(!$url_headers || $url_headers[0] == 'HTTP/1.1 404 Not Found') {
$exists = false;
}
else {
$exists = true;
}
if(filter_var($url, FILTER_VALIDATE_URL) == FALSE || $exists == false) {
$error .= '<div class="alert alert-danger" role="alert">That city could not be found.</div>';
} else if (filter_var($url, FILTER_VALIDATE_URL) == TRUE && $exists == true){
$html = file_get_contents($url);
if ($html != FALSE && $html != NULL)
echo $html
}