title: How to copy the source html file and save it after replacing string to another directory using php?
body: <pre><code> $a = trim($allDataInSheet [$i]["A"]); 
   $b=trim($allDataInSheet [$i]["B"]);
   /* copy the source file */
      $fname = "edm.html";
       copy("edm.html","hk/edm.html");
      $fcopy="hk/edm.html";
  
       /* read the duplicate file */
      $fhandle = fopen($fcopy,"r");
      $content = fread($fhandle,filesize($fcopy));
  
      /* replace the string in the duplicate file */
      $content = str_replace($a,$b, $content);
      $fhandle = fopen($fcopy,"w");
      fwrite($fhandle,$content);
      fclose($fhandle);
  </code></pre>
  
  <p>Above code was not working properly,I dont want to replace the string inside the source file.I need to take the duplicate of the source file and change the strings.Thanks in advance.Pleaes help me to fix it..</p>