I am certainly not an expert in PHP, and have surfed SO thoroughly but didn’t find anything related to this. Might mean that the question is stupid, but I was trying to create a new php file on sign up (so to provide rss feeds for each person who signs up) and I’ve managed so far to create a beatifully empty file. Here’s the code of a test file I have written in the end, with GET function:
$USR = $_GET['usr'];
$FILE=$USR.'.rss.php';
$file1 = 'rssdemo.php';
$handle = fopen($file1, 'a');
$contents = fread($handle, filesize($file1));
fclose($handle);
$file2 =$FILE;
$handle = fopen($file2, 'wb');
fwrite($handle, $contents); //this should write something but does nothing
fclose($handle);
As you can see, the file I am trying to copy from is a PHP file (that should in its turn generate the XML file).
Is there a way to create a new php file, open an old one, copy the content of it and paste it into the newly created file? Or maybe fwrite () can be used for text only? Some help please! Thanks in advance.
You should simply have one url per user, like this: http://www.example.com/index.php/greg0ire/rss
Use a rewrite rule so that index.php gets called, and analyse the “greg0ire/rss” part to route to an Rss action that has a user parameter, and pass it the “greg0ire” as an argument.