{"id":1451,"date":"2022-08-30T15:16:38","date_gmt":"2022-08-30T15:16:38","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/19\/how-to-get-the-stream-of-a-public-facebook-fanpage-in-php-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:16:38","modified_gmt":"2022-08-30T15:16:38","slug":"how-to-get-the-stream-of-a-public-facebook-fanpage-in-php-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/how-to-get-the-stream-of-a-public-facebook-fanpage-in-php-collection-of-common-programming-errors\/","title":{"rendered":"How to get the stream of a public Facebook fanpage in php?-Collection of common programming errors"},"content":{"rendered":"<p>I want to display my public fanpage feed onto my website via the Facebook API without requiring a login.<\/p>\n<p>I&#8217;m doing this<\/p>\n<pre><code>require_once('..\/includes\/classes\/facebook-platform\/php\/facebook.php');\n\n$fb = new Facebook($api_key, $secret);\n$fb-&gt;api_client-&gt;stream_get('',$app_id,'0','0','','','','',''));\n<\/code><\/pre>\n<p>But I get this error<\/p>\n<pre><code> Fatal error:  Uncaught exception 'FacebookRestClientException' with message 'user id parameter or session key required' in includes\/classes\/facebook-platform\/php\/facebookapi_php5_restlib.php:3065\n Stack trace:\n#0 includes\/classes\/facebook-platform\/php\/facebookapi_php5_restlib.php(1915): FacebookRestClient-&gt;call_method('facebook.stream...', Array)\n#1 facebook\/api.php(12): FacebookRestClient-&gt;stream_get('', 13156929019, '0', '0', 30, '', '', '', '')\n#2 {main}\n  thrown in includes\/classes\/facebook-platform\/php\/facebookapi_php5_restlib.php on line 3065\n<\/code><\/pre>\n<p>Then I figured, because of &#8216;user id parameter or session key required&#8217;, to add my user id to the call<\/p>\n<pre><code>require_once('..\/includes\/classes\/facebook-platform\/php\/facebook.php');\n\n$fb = new Facebook($api_key, $secret);\n$fb-&gt;api_client-&gt;stream_get(502945616,13156929019,$app_id,'0','0','','','','',''));\n<\/code><\/pre>\n<p>But then I got this error<\/p>\n<pre><code>Fatal error:  Uncaught exception 'FacebookRestClientException' with message 'Session key invalid or no longer valid'\n<\/code><\/pre>\n<p>I&#8217;m totally clueless \ud83d\ude42<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-19 13:17:16. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I want to display my public fanpage feed onto my website via the Facebook API without requiring a login. I&#8217;m doing this require_once(&#8216;..\/includes\/classes\/facebook-platform\/php\/facebook.php&#8217;); $fb = new Facebook($api_key, $secret); $fb-&gt;api_client-&gt;stream_get(&#8221;,$app_id,&#8217;0&#8242;,&#8217;0&#8242;,&#8221;,&#8221;,&#8221;,&#8221;,&#8221;)); But I get this error Fatal error: Uncaught exception &#8216;FacebookRestClientException&#8217; with message &#8216;user id parameter or session key required&#8217; in includes\/classes\/facebook-platform\/php\/facebookapi_php5_restlib.php:3065 Stack trace: #0 includes\/classes\/facebook-platform\/php\/facebookapi_php5_restlib.php(1915): FacebookRestClient-&gt;call_method(&#8216;facebook.stream&#8230;&#8217;, [&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-1451","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1451","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=1451"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1451\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1451"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1451"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}