So I've been trying to embed a part of a website within my website due to security reasons I cannot disclose the website that I am trying to embed so for the purpose of this example I am going to use bbc.co.uk.
The following is the php/html code:
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<?php
$page = file_get_contents('http://www.bbc.co.uk/');
$doc = new DOMDocument();
$doc->loadHTML($page);
$divs = $doc->getElementsByTagName('div');
foreach($divs as $div) {
// Loop through the DIVs looking for one withan id of "content"
// Then echo out its contents (pardon the pun)
if ($div->getAttribute('id') === 'orb-footer') {
echo $div->nodeValue;
}
}
?>
</body>
<footer>
</footer>
</html>
However when I load the page I get left with a page displaying the php code. Can anyone tell me where I am going wrong please.
Thank you!!