title: PHP - Write text file content in another text file
body: <p>I want to check if the content of a text file is the same as another, and if it isn't, write one into the other. My code is as follows:</p>
  
  <pre><code>&lt;?php $file = "http://example.com/Song.txt";
  $f = fopen($file, "r+");
  $line = fgets($f, 1000);
  $file1 = "http://example.com/Song1.txt";
  $f1 = fopen($file1, "r+");
  $line1 = fgets($f1, 1000);
  if (!($line == $line1)) {
      fwrite($f1,$line);
      $line1 = $line;
      };
  print htmlentities($line1);
  ?&gt;
  </code></pre>
  
  <p>The line is being printed out, but the content isn't being written in the file.</p>
  
  <p>Any suggestions about what might be the problem?</p>
  
  <p>BTW: Im using 000webhost. I'm thinking it's the web hosting service but I've checked and there shouldn't be a problem. I've also checked the <code>fwrite</code> function here: <a href="http://php.net/manual/es/function.fwrite.php" rel="nofollow">http://php.net/manual/es/function.fwrite.php</a>.
  Please, any help will be very aprecciated.</p>