我正在尝试制作图表API GET请求。它适用于Graph API资源管理器,但我似乎无法让应用程序自行调用它。
我正在尝试检索用户对象中的共同朋友。见文档: https://developers.facebook.com/docs/reference/api/user/
<?php
$mutual = json_decode(file_get_contents("https://graph.facebook.com/".$fb_id."?".$access_token."/mutualfriends/".$other_fb_id));
?>
但这似乎不起作用。
答案 0 :(得分:7)
您将网址参数与path
混合在一起,应该是这样的(?access_token=...
部分应放在最后):
$url = "https://graph.facebook.com/{$fb_id}/mutualfriends/{$other_fb_id}";
$url_with_token = $url . "?access_token={$access_token}";
$mutual = json_decode(file_get_contents($url_with_token));