Im grabbing a page with below.
$homepage = file_get_contents('http://www.example.com/'); echo $homepage;
How do I write it to a file.txt and overwite in the event the file exists ?
Thanks.
@reco21
Did you read and check the manual:
http://php.net/manual/en/function.file-get-contents.php
-
<?php $homepage = file_get_contents('http://www.example.com/'); $filename = $homepage.'\example.txt'; $handle = fopen($filename,"x+"); $somecontent = ""; fwrite($handle,$somecontent); echo "Success"; fclose($handle); ?>
thank you. Yeah I was caught up on file_put_contents. Thanks again.