title: In a foreach loop and write a file
body: <p>I currently have this code:</p>
  
  <pre><code>$json = file_get_contents('http://openstates.org/api/v1/legislators/?active=true&amp;state=fl&amp;&amp;chamber=upper&amp;apikey=ba09e678541e4b6ea28348c4517a6d50');
  $obj = json_decode($json);
  
  
  foreach($obj as $index =&gt; $user) 
      echo $user-&gt;photo_url;
  </code></pre>
  
  <p>Works great at echoing the list.  What I would like to do instead of echoing the information could I possibly take the links and download the image files?</p>
  
  <p>Or instead of echoing save the names to a one big file list?</p>
  
  <p>I have been trying all sorts of of stuff for the past 2 days.  Any help would be greatly appreciated.</p>