title: file_get_contents returning corrupted image from URL
body: <p>I'm using this code to download image files from the Mapquest Traffic API.</p>
  
  <pre><code>&lt;?php
  $files = glob("/root/TrafficHistory/*.gif");
  $lastFileName = $files[count($files)-1];
  
  $newFile = time() . ".gif";
  
  $imgData = file_get_contents("http://www.mapquestapi.com/traffic/v2/flow?key=**REMOVED**&amp;mapLat=34.05396382838673&amp;mapLng=-118.24529104634557&amp;mapHeight=1000&amp;mapWidth=1000&amp;mapScale=433342");
  file_put_contents("/root/TrafficHistory/" . $newFile, $imgData);
  
  $md5Old = md5_file($lastFileName);
  
  if ($md5Old == md5_file("./" . $newFile)) {
      unlink("./" . $newFile);
      echo "\033[31mTraffic data same at " . time() . " aborting.\033[0m\n";
  } else {
      echo "\033[32mNew traffic data downloaded to /root/TrafficHistory/" . $newFile  . " at " . time() . "\033[0m\n";
  }
  ?&gt;
  </code></pre>
  
  <p>The code works flawlessly though my error occurs while saving the image. As seen <a href="http://i.imgur.com/QiU8B1O.jpg" rel="nofollow">here</a> you can see that the traffic overlay downloaded through <code>file_get_contents</code> does not seem to fully download the GIF image. Here's a <a href="http://joshua-ferrara.com/hotlink-ok/1385957881.gif" rel="nofollow">link to the GIF</a> in question (it display's correctly in the browser though will not open in PhotoShop stating unexpected end of file). Note that all of the images downloaded through <code>file_get_contents</code> display this way. Though when viewed directly through the API link they display perfectly. Here's a <a href="http://www.mapquestapi.com/traffic/" rel="nofollow">link to the Mapquest Traffic API</a> as well, if it's needed. Thanks for your help.</p>