如何使用php读取变量地址的整个页面

how can Dynamic this code with php .my address is variable

<?php
$pagecontents = file_get_contents("http://google.com");
$html = htmlentities($pagecontents);
echo $html;
?>

I'm not sure, I understood, what the goal is, but if you want to do the same thing, that you have shown in the question but with multiple sites, then you can do it with a simple loop:

$sites = ["aa.com/a", "aa.com/b"] // array(...) with earlier PHP versions
foreach($sites as $url) {
    $pagecontents = file_get_contents($url);
    echo htmlentities($pagecontents);
}

If this is not what you are looking for, then please refactor the question, so it clearly explains, what you want to do!