Saving images from an associative array
<pre><code>$object = json_decode(file_get_contents('https://api.500px.com/v1/photos/?feature=user&amp;username=nsz&amp;consumer_key=xxx'), true);
</code></pre>

<p>This object have the following structure:</p>

<pre><code>Array
(
[0] =&gt; Array
    (
        [id] =&gt; 176621
        [name] =&gt; ***
        [description] =&gt; 
        [times_viewed] =&gt; 1411
        [rating] =&gt; 47.7
        [created_at] =&gt; 2010-10-08T14:39:43-04:00
        [category] =&gt; 11
        [privacy] =&gt; 
        [votes_count] =&gt; 65
        [favorites_count] =&gt; 8
        [comments_count] =&gt; 7
        [nsfw] =&gt; 
        [store_width] =&gt; 643
        [store_height] =&gt; 915
        [image_url] =&gt; http://pcdn.500px.net/176621/6f2932b14d545f9664e9472a01ae74596f8d4588/2.jpg
</code></pre>

<p>What i would like to know is: How to make a foreach loop that saves each file from the <code>[image_url]</code> to my server.</p>

<p>This seems to be working, but i dont know how to make the loop:</p>

<pre><code>copy('http://path/to/image.jpg', 'images/flower.jpg');
</code></pre>

<p>Thanks in advance!</p>
