get source for web page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lior2000
Forum Newbie
Posts: 2
Joined: Tue Jun 07, 2005 12:23 pm

get source for web page

Post by lior2000 »

Hello everbody,

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

Thanks in advance,
Lior.
Sphen001
Forum Contributor
Posts: 107
Joined: Thu Mar 10, 2005 12:24 pm
Location: Land of the Beaver

Post 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
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Code: Select all

<?php 
echo htmlentities(file_get_contents("http://google.com"));
?>
lior2000
Forum Newbie
Posts: 2
Joined: Tue Jun 07, 2005 12:23 pm

Thanks

Post by lior2000 »

Thanks!!! that really helped me!
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

remove htmlentities if you want to actually display the html and not its entities
Post Reply