我正在尝试通过图形 api 从代码中检索用户名,当我在另一个(godaddy)服务器上托管应用程序时,下面的代码运行良好,但最近我将应用程序移至 phpfog,从那时起我就面临这个奇怪的问题。
try {
$userId = $_POST["user_id"];
$oauth_token = $_POST["oauth_token"];
$userName = json_decode(file_get_contents('https://graph.facebook.com/' . $userId)) -> name;
$userGender = json_decode(file_get_contents('http://graph.facebook.com/' . $userId)) -> gender;
$userPpicture = json_decode(file_get_contents('http://graph.facebook.com/' . $userId)) -> picture;
} catch(Exception $e) {
echo $e -> getMessage();
echo "<br>";
}
只是补充一下,因为这可能有助于在下一行中,我可以通过以下方式成功检索用户个人资料图片:
<img class=\"ppicture\" src=\"https://graph.facebook.com/" . $userId . "/picture?type=large\">
除了这段代码不起作用之外,照片发布功能也刚刚停止工作。请帮我解决这个问题。
谢谢你。