process/save webpage from list of links

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
jaymoore_299
Forum Contributor
Posts: 128
Joined: Wed May 11, 2005 6:40 pm
Contact:

process/save webpage from list of links

Post by jaymoore_299 »

If I have a link, how do I save that webpage source in a file using php without displaying it?

I also want to be able to process a webpage so that I could modify it then send the output to the browser.

How do I do this?[/u]
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

file_get_contents and the http(s) stream wrappers enabled it's a breeze...

Code: Select all

$file = file_get_contents('http://timvw.madoka.be/thief.php');

// store file (php5 only function)
file_put_contents('thief.txt', $file);

// convert to lowercase and display
echo strtolower($file);
Post Reply