我正在尝试发出图形 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));
?>
但这似乎不起作用。
最佳答案
您将 URL 参数与 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));
关于php - Facebook Graph API GET http 请求,php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9234575/