PHP Code to Display Other website in Our webpage

By | August 26, 2012

We can display some others website and webpages in our website. By using php code, we can get source code of a webpage. The source code, which we had got that have to be used to display the website. URL will be get through POST method and using PHP function file_get_contents() will get URL’s source code and display that website.

[code type=php]

<html>
<head>
<title>PHP Code to display website in Our webpage</title>
</head>
<body>
<fieldset style=”background-color:#666; height:50px; padding:20px;”>
<center><form method=”post” action=”a.php”>
URL: <input type=”text” name=”url” />
<input type=”submit” name=”submit” />
</form>
</center>
</fieldset>
<?php
if(isset($_POST[‘submit’]) && isset($_POST[‘url’]))
{
$url=$_POST[‘url’];
$a=file_get_contents($url);
echo $a;
}

?>
</body>
</html>

[/code]

Leave a Reply

Your email address will not be published. Required fields are marked *

makalu-lexeme