How to read a web page in PHP?

php, web

Solution

One way:

$url = "http://www.brothersoft.com/publisher/xtracomponents.html";
$page = file_get_contents($url);
$outfile = "xtracomponents.html";
file_put_contents($outfile, $page);

The code above is just an example and lacks any(!) error checking and handling.

Problem

I'm trying to save some web pages to text files using PHP scripts. How can I load a web page into a file buffer with PHP and remove HTML tags?

Original source