从 Graph 复制 Facebook 个人资料图片 API URL

Copy Facebook profile picture from Graph API URL

我使用以下简单代码将图像从他们的 URL 复制到我的 localhost/server;但是当我将它与 Facebook Graph API 一起使用时它不起作用。例如:

 $url="http://graph.facebook.com/4/picture?type=large";
 copy($url,"newImageName.jpg");

备注: 没有显示错误。图片没有上传。

我该如何解决这个问题?

我在 @luschn and @Joe 个答案中找到了解决方案。感谢他们俩。

$arrContextOptions=array(
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
),
);  
$url="http://graph.facebook.com/userID/picture?type=large";
$data=file_get_contents($url, false, stream_context_create($arrContextOptions));
$fileName = 'fb_profilepic.jpg';
$file = fopen($fileName, 'w+');
fputs($file, $data);
fclose($file);