Read a line from a text file, then delete it
<p>I have a text file , filled with pipe separated URLs, like this:</p>

<pre><code>http://www.example.com|http://www.example2.com|http://www.example3.com|.... 
</code></pre>

<p>etc.</p>

<p>I currently have this code to read each url from the file and pass it to a function:</p>

<pre><code>&lt;?php
  $urlarray = explode("|", file_get_contents('urls.txt'));

  foreach ($urlarray as $url) {

   function1($url);

   }

?&gt;   
</code></pre>

<p>What I want to do next is, after function1() is done, delete that URL from the text file.That way, when the script is done going through all the URLs in urls.txt, this text file should be empty.</p>

<p>How can I achieve this?</p>

<p>Thanks,
Rafael</p>
