title: Saving User's Profile Picture from facebook API - PHP SDK V.5
body: <p><strong>Scenario:</strong> I am working on an app through which i need to download the user's profile picture from Facebook, apply a specific filter and then re-upload and set it as profile picture, which is possible using this trick. '<strong>makeprofile=1</strong>'</p>
  
  <pre><code>http://www.facebook.com/photo.php?pid=xyz&amp;id=abc&amp;makeprofile=1 
  </code></pre>
  
  <hr>
  
  <p><strong>Problem:</strong>
  So the problem i am facing is while downloading the picture from the received URL via API. I am obtaining the picture URL this way:</p>
  
  <pre><code>$request = $this-&gt;fb-&gt;get('/me/picture?redirect=false&amp;width=9999',$accessToken); // 9999 width for the desired size image
  
  // return object as in array form
  $pic = $request-&gt;getGraphObject()-&gt;asArray();
  
  // Get the exact url
  $pic = $pic['url'];
  </code></pre>
  
  <hr>
  
  <p>Now i want to save the image from obtained URL to a directory on my server, so that i can apply the filter and re-upload it.
  When i use <strong>file_get_contents($pic)</strong> it throws following error</p>
  
  <pre><code>file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed 
  </code></pre>
  
  <p>I have tried a few other methods as well but could not get this fixed. Any help would be appreciated :)</p>
  
  <p><strong>NOTE:</strong> I am doing this through Codeigniter and on localhost for now.</p>