Page 1 of 1

get source for web page

Posted: Tue Jun 07, 2005 12:25 pm
by lior2000
Hello everbody,

Does anyone know how can I get the HTML source of a web page using php?

Thanks in advance,
Lior.

Posted: Tue Jun 07, 2005 12:31 pm
by Sphen001
Hi,

To get the HTML source, browse to the site in question, and press Ctrl + U (or View->View Source).

Hope this helps :D

Sphen001

Posted: Tue Jun 07, 2005 12:33 pm
by anjanesh

Code: Select all

<?php 
echo htmlentities(file_get_contents("http://google.com"));
?>

Thanks

Posted: Tue Jun 07, 2005 12:47 pm
by lior2000
Thanks!!! that really helped me!

Posted: Tue Jun 07, 2005 3:14 pm
by John Cartwright
remove htmlentities if you want to actually display the html and not its entities