![](/img/trans.png)
[英]How to identify a facebook default Profile Picture from response of Facebook Graph API?
[英]Copy Facebook profile picture from Graph API URL
我使用以下簡單代碼將圖像從其 URL 復制到我的本地主機/服務器; 但是當我將它與 Facebook Graph API 一起使用時它不起作用。 例如:
$url="http://graph.facebook.com/4/picture?type=large";
copy($url,"newImageName.jpg");
注意:沒有顯示錯誤。 圖片沒有上傳。
我該如何解決這個問題?
我在@luschn和@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);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.