PHP - Retrieve Facebook image in Google Compute Engine

I've tried to retrieve the image data of my Facebook profile picture, using both file_get_contents and curl.

The problem occurs on my Google compute engine instance, while on any other server (localhost - mamp, AWS) the script works fine.

An example for one of the scripts I was using

<?php var_dump( json_decode( file_get_contents("https://graph.facebook.com/_FACEBOOK_ID_/picture?width=720&height=720") ) );

Please keep in mind that I've tried using the parameter redirect=false, and accessing the image url I've got in my json response returned false as-well.

Also, I've tried using wget in SSH to the image's url, which returned (403) Forbidden.

My assumption is that I need to configure something differently in my server, not PHP, but because I'm able to retrieve any other image, with the same script - I'm not sure what.


I've already experienced this exact problem, Ignoring SSL verification while using cURL did the trick for me.

$ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Ignore SSL verification curl_setopt($ch, CURLOPT_URL, "https://graph.facebook.com/_FACEBOOK_ID_/picture?width=720&height=720"); $data = curl_exec($ch); curl_close($ch); var_dump($data);


  • How to get a single value from a query result in php
  • phpunit -d flag limitations?
  • Laravel 5.3 : Passport Implementation - {“error”:“invalid_client”,“message”:“Client authentication f
  • PHP script receives GET instead of POST REQUEST
  • PHP not converting JSON using 'json_decode()'
  • Is creating a new version of an object in AWS S3 eventually consistent or read-after-write consisten
  • AWS Cognito- get user information with ID
  • Dynamically create AWS IoT topic
  • testing a POST using phpunit in laravel 4
  • python: forcing relative imports to search from script file
  • Python 3.2.2, error(scripts to exe)
  • Drawing a Path in XAML (with binding) vs. C#. One works, one doesn't
  • chrome video src change not working
  • WPF Template Binding in ToggleButton UserControl
  • WPF version of .ScaleControl?
  • blade.php method outputting it's result to the form
  • D3 get axis values on zoom event
  • Test if a set exists before trying to drop it
  • OpenGL 3.3 on Mac OSX El Capitan with LWJGL
  • Javascript simulate pressing enter in input box
  • How to recover from a Spring Social ExpiredAuthorizationException
  • ILMerge & Keep Assembly Name
  • How to show dropdown in excel using jrxml (jasper api)?
  • Importing jscolor library in angular 2
  • Large data - storage and query
  • How can I estimate amount of memory left with calling System.gc()?
  • WOWZA + RTMP + HTML5 Playback?
  • Circular dependency while pushing http interceptor
  • Linker errors when using intrinsic function via function pointer
  • A cron job substitute?
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • Hits per day in Google Big Query
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • python draw pie shapes with colour filled
  • Append folder name and increment by 1 using batch script
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal