I am using facebook graph api, to retrieve logged in user’s info.
$facebookdata = json_decode(file_get_contents('https://graph.facebook.com/me?access_token=' . $fb_accesstoken . '&fields=name,picture'),true);
Now When I var_dump I get null. I did try to goto url https://graph.facebook.com/me?access_token=ACCESS_TOKEN&fields=id,name,picture. It shows the name and photourl.
I appreciate any help.
Check if
allow_url_fopenis enabled in yourphp.ini. Otherwise adapt, because file_get_contents will not be able to read from http URLs then.Second, raise your
error_reportinglevel. It should have told you so.If you get no error message, then access with the PHP
user_agentmight be blocked. There is another php.ini setting for that. Also alternatively, just trycurl.