jencinas69 0 Junior Poster in Training

I have this code

<?php  
      
error_reporting(E_ALL ^ E_NOTICE);
ini_set("display_errors", true);

$file = "pets_feed_" . date("Ymd") . ".txt";// - for yyyymmdd
  
if (!file_exists($file)) touch($file);

$fh = fopen($file, "r");

$fcontent = @fread($fh, filesize($file));

$towrite = "ID Category    Description"."\n";


$fh22 = fopen($file, 'w+');

fwrite($fh22, $towrite . $fcontent );

fclose($fh);

fclose($fh22);

?>

What it does is that Creates a new file and writes ID Category Description on top
but I also need to read anothe file in my server and write the content on that file into the new file I am creating

Any help

Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.