facebook-php-sdk list my fb page admins works on localhost, not on production -


The code below runs as expected on my local machine, but throws the following error on my output:

Fatal Error: Undiscovered OAuthException: An active access token should be used to ask information about the current user.

I have double-checked my config and page permissions, but can not find the reason.

  is required 'facebook-php-sdk / src / facebook.php'; $ Path = $ _SERVER ['DOCUMENT_ROOT']. '/ .. / conf /' php_uname ('n'). '.ini'; $ IniConfig = parse_ini_file ($ path, true); $ Page_id = $ ini config ['fb_entent'] ['page_id']; $ Facebook = New Facebook (array ('appId' => $ ini config ['FB_tentent'] ['APPID'], 'secret' => $ ini confef ['FB_thant'] ['secret']) ); $ User = $ facebook-> GetUser (); $ Page_info = $ facebook-> API ('/' .page_id. '? Fields = access_token'); If (! $ Page_info ['access_token'])) {# If we have access_token, $ args = array ('access_token' = & gt; $ page_info ['access_token'], 'scope' = & gt; 'Publish_stream, manage_pages'); } # Our administrator information $ a_admins = $ facebook- & gt; Get API ('/'. $ Page_id. '/ Admins', 'get', $ args); $ {$ Myadmin [] = Array ('name' = & gt; $ thisadmin ['name'], 'id' => $ thisadmin ['foreign currency' ($ a_admins ['data'] $ as thisadmin] Id ']); } Print_a ($ myadmin); Function print_a ($ arr) {echo "& lt; PRE>"; Print_r ($ arrivals); Echo "& lt; / PRE>"; }  


Comments