Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>1.First you have to get the page access token.</p> <pre><code>public function getPageToken() { $page_id = "xxxxxxxxxx"; $page_access_token = ""; $result = $this-&gt;facebook-&gt;api("/me/accounts"); if( !empty($result['data']) ) { foreach($result["data"] as $page) { if($page["id"] == $page_id) { $page_access_token = $page["access_token"]; break; } } } else { $url = "https://www.facebook.com/dialog/oauth?client_id=xxxxxxxxxx&amp;redirect_uri=http://apps.facebook.com/xxxxxx&amp;scope=manage_pages&amp;response_type=token"; echo "&lt;script type='text/javascript'&gt; top.location.href='".$url."'; &lt;/script&gt;"; } return $page_access_token; } </code></pre> <p>2.After getting the page access token just include that token in your post to wall code.</p> <pre><code>&lt;script src="//connect.facebook.net/en_US/all.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var token = '&lt;?php echo $page_access_token ?&gt;'; var wallPost = { access_token: token, message : 'xxxxxxxx', link : 'http://apps.facebook.com/xxxxxxx/', picture : 'xxxxxxxx', name : 'xxxxx', caption : 'xxxxxx', description : 'xxxxxxx', }; FB.api('/pageid/feed', 'post', wallPost, function(response) { if (!response || response.error) { } else { } }); &lt;/script&gt; </code></pre> <p>3.Remember this code will only publish your post on Fan page's wall and users who liked the fan page will be able to see that post as the post is posted on their own feed.</p> <p>Hope this will solve your problem.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload