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,312
  • 15
  • 42
  • 65

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,267
  • 4
  • 40
  • 59
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,394
  • 4
  • 24
  • 42