PHP Knowledge Base

file_put_contents

Example 1: Simple

Code

<?php
$url = "https://bettermousetraps.net/bio.html";
$biopage__dest = "./example__file_put_contents/bio_test.html";
$biopage__src = file_get_contents($url);

file_put_contents($biopage__dest, $biopage__src)
?>

Output

./example__file_put_contents/bio_test.html already exists: no action needed.

* Page would output with all the linebreaks of the original file intact and the php echo command would cause browser to render the page.