{"id":1462,"date":"2022-08-30T15:16:44","date_gmt":"2022-08-30T15:16:44","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/19\/requires-user-session-error-while-using-fql-in-facebook-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:16:44","modified_gmt":"2022-08-30T15:16:44","slug":"requires-user-session-error-while-using-fql-in-facebook-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/requires-user-session-error-while-using-fql-in-facebook-collection-of-common-programming-errors\/","title":{"rendered":"Requires user session error while using FQL in facebook-Collection of common programming errors"},"content":{"rendered":"<p>I am making a fb app and this is what I need to do:<\/p>\n<p>I get the page id of a business page and I need to get the admin_id of the page. I am using the following code and I get the error message which I have copied at the end.<\/p>\n<p>Can anyone kindly help me ? Thanks.<\/p>\n<pre><code>include_once 'facebook.php';\n\n$facebook = new Facebook($api_key, $secret);\n\n\/\/$page_ids == page_id of a business\/fan page  \n\n$query=\"SELECT uid from page_admin where page_id =\".$page_ids.\";\";\n\n$admins =$facebook-&gt;api_client-&gt;fql_query($query);\n\nforeach ($admins as $jerry) {\n  echo $jerry['uid'].\"<br \/>\";\n}\n<\/code><\/pre>\n<p>error message:<\/p>\n<pre><code>Fatal error: Uncaught exception 'FacebookRestClientException' with message 'Requires user session' in \/var\/www\/seanpeace\/data\/www\/racersnation.com\/facebookTest\/facebookapi_php5_restlib.php:3112 Stack trace: #0 \/var\/www\/seanpeace\/data\/www\/racersnation.com\/facebookTest\/facebookapi_php5_restlib.php(1025): FacebookRestClient-&gt;call_method('facebook.fql.qu...', Array) #1 \/var\/www\/seanpeace\/data\/www\/racersnation.com\/facebookTest\/profile.php(64): FacebookRestClient-&gt;fql_query('SELECT uid from...') #2 {main} thrown in \/var\/www\/seanpeace\/data\/www\/racersnation.com\/facebookTest\/facebookapi_php5_restlib.php on line 3112\n<\/code><\/pre>\n<p id=\"rop\"><small>Originally posted 2013-11-19 13:18:15. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I am making a fb app and this is what I need to do: I get the page id of a business page and I need to get the admin_id of the page. I am using the following code and I get the error message which I have copied at the end. Can anyone kindly [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1462","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1462","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1462"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1462\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1462"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1462"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1462"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}