using php inside of iframe html tags

Firelight picture Firelight · Nov 29, 2013 · Viewed 49.4k times · Source

I am trying to create a website that displays another website in an iframe.

This is my code:

<html> 
<title>HTML with PHP</title>
<style>
body {
margin: 0px;
}
</style>
<body>
<?php
$page = $_GET['query'];
echo $page;
?>
<iframe align="center" width="100%" height="100%" src="<?=$page;?>" frameborder="yes" scrolling="yes" name="myIframe" id="myIframe"> </iframe>
</body>
</html>

When I open the php file off of my website (using a url website.com/file.php?query=https://www.google.com, and look in the inspector, I can see the page that the iframe loaded, but it just shows up as a blank page, not the . I have it up at http://www.test.fire-light.tk/web.php?query=url (replace url with any valid url). I am not sure why it shows the blank page.

Answer

Arup Garai picture Arup Garai · Aug 12, 2016

Using Iframe you can call PHP file in HTML file . And write your PHP code in test.php Iframe code <iframe src="test.php"></iframe>