0

Possible Duplicate:
Best methods to parse HTML with PHP

I wish to get the code of a website as you can with "view source" but dynamically. I found a site which does exactly what i want - http://www.iwebtool.com but I wish to implement it by myself. any ideas? thanks!

Community
  • 1
  • 1
tomermes
  • 22,950
  • 16
  • 43
  • 67

2 Answers2

1

You chould give this a try in a php page:

<html>
<head><title>title</title></head>
<body>
<xmp>
<?php echo file_get_contents('http://www.google.com'); ?>
</xmp>
</body>
</html>

You could replace 'http://www.google.com' with the value of a variable you can set dynamically.

Andreas
  • 5,305
  • 4
  • 41
  • 60
0

<xmp> is deprecated also you should take care of html special chars so I'd go with:

<pre>
    <?php echo htmlentities( file_get_contents( 'http://www.somewebsite.com/somepage.html' ) ); ?>
</pre>
nobody
  • 10,599
  • 4
  • 26
  • 43