title: file_get_contents gives me failed to open stream
body: <p>I have simple CI (CodeIgniter) code. what I want to do is: when I enter the pictures path to textarea, php downloaded each picture to my server and gave them filenames, but I have these errors:</p>
  
  <pre><code>Message: file_get_contents(http://geosmiley.ge/Upload/Product/42/1.jpg ) [function.file-get-contents]: failed to open stream: Invalid argument
  
  Message: file_get_contents(http://geosmiley.ge/Upload/Product/42/2.jpg ) [function.file-get-contents]: failed to open stream: Invalid argument
  </code></pre>
  
  <p>Here is my CI code:</p>
  
  <pre><code>$image = explode("\n", $_POST['images']);
  for ($i = 0; $i &lt; count($image); $i++){
      if (substr($image[$i], 0, strlen($this-&gt;host) - 1) != $this-&gt;host){
          file_put_contents('images/'.$title_url.'_'.$i.'.jpg', file_get_contents($image[$i]));
          $image[$i] = $this-&gt;host.'/images/'.$title_url.'_'.$i.'.jpg';                                
      }
  }
  $poster = $image[0];
  $images = implode("\n", $image);
  </code></pre>
  
  <p><em><strong>What it does is simply downloads last file and for first and second files gives me that error</em></strong></p>
  
  <p>and please don't give me other advice like using cURL of fopen. I think that it is correct way because php downloads LAST FILE successfully. Please help me to solve my problem</p>