Scenario: 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. 'makeprofile=1'
http://www.facebook.com/photo.php?pid=xyz&id=abc&makeprofile=1
Problem: 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:
$request = $this->fb->get('/me/picture?redirect=false&width=9999',$accessToken); // 9999 width for the desired size image
// return object as in array form
$pic = $request->getGraphObject()->asArray();
// Get the exact url
$pic = $pic['url'];
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 file_get_contents($pic) it throws following error
file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
I have tried a few other methods as well but could not get this fixed. Any help would be appreciated :)
NOTE: I am doing this through Codeigniter and on localhost for now.