Jump to content

Saving a file locally, but comparing it to existing file first


writer

Recommended Posts

I'm using the following code to copy an XML feed locally, but I'd like it to first check the remote file to see if it's the same as the original file... if so, I don't need to copy it again.

 

<?php
$content = $_POST['content'];
$file = $_POST['fileName'];
$content = stripslashes($content);
$writeFile = fopen($file, "w");
if(fwrite($writeFile, $content))
{ echo $content; }
else { echo "Error writing to file"; }
fclose($writeFile);
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.