fetch a whole website

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
dappa
Forum Newbie
Posts: 5
Joined: Sun Feb 04, 2007 1:36 pm

fetch a whole website

Post by dappa »

How can I fetch whole website and then echo only text and links that site have, excluding all pictures and fancy layout?

So what happens for user is that, he inputs some URL and then see text and links that site contains.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

fopen() w/ allow_url_fopen enabled and some regex.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

I don't see a valid reason for doing this.
dappa
Forum Newbie
Posts: 5
Joined: Sun Feb 04, 2007 1:36 pm

Post by dappa »

scottayy wrote:I don't see a valid reason for doing this.
Doing this allows me to browse web-sites via my cell phone that have a simple WAP function but no real web-browser.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Oh.

file_get_contents() and a regex matching <a></a> tags would work.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Check out wget. You can recursively download websites with wget. It's a command line tool though.
Post Reply