store emails in textfile one per line
<p>This snippet of code renders a users email when a user enters a page of my site: ...</p>

<pre><code>$email=$userprofile-&gt;email;
</code></pre>

<p>... you can echo it like this:</p>

<pre><code>&lt;?php echo $email;?&gt;
</code></pre>

<p>but how would you store it in a text file in a directory or folder of my choosing  with one email per line? thanks</p>

<p>i tried this but it wont work</p>

<pre><code>&lt;?php
$file = 'http://mydomain.com/file/email.txt';
// Open the file to get existing content

// Write the contents back to the file
file_put_contents($file, $email);
?&gt;
</code></pre>
