upload multiple images with php
<p>I have xml file with collection image urls and I want upload this url using php.
I try using this function:</p>

<pre><code>public function get_file($source, $destination) 
{
  $ctx = stream_context_create(array('http' =&gt; array('timeout' =&gt; 90)));
  $content = file_get_contents($source, null, $ctx);
  $f = fopen($destination, "wb");
  fwrite($f, $content);
}
</code></pre>

<p>I try download about 7000 images, but after about 500 images, it ceases to copy images and hangs on the file.
What's wrong?</p>
