Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I've developed same kind of application in Zend-Framework. I've used Facebook/PHP-SDK with oAuth 2.0. </p> <p>In this case you need to save access tocken in your database for the particular user. and with that access token you can get any data as well as post to. Yes for that you need to grant necessary permission from the user for your Facebook APP.</p> <p>Here is the two function that I've used in my application to fetch the access token , extended it and store in the database.</p> <pre><code> /** * Getting User Acess Tocken , extended it and save it in to database...... */ public function getAccessToken($user_id,$fb_account_id) { $access_token=$this-&gt;facebook-&gt;getAccessToken(); $extended_access_token=$this-&gt;getExtendedAccessToken($access_token); /** * To save Access tocken and other necessary option */ $usr_bus_model = new Application_Model_UserBusinessAccounts; $usr_bus_model-&gt;loadAccount($user_id,'Facebook',(int)$fb_account_id); $usr_bus_model-&gt;details=$extended_access_token; $usr_bus_model-&gt;save(); return $extended_access_token; } /** * Exrending User Acess Tocken..... */ public function getExtendedAccessToken($access_token) { $token_url="https://graph.facebook.com/oauth/access_token"; $params=array('client_id'=&gt;self :: appId,'client_secret'=&gt;self :: appSecretId,'grant_type'=&gt;'fb_exchange_token','fb_exchange_token'=&gt;$access_token); $response = $this-&gt;curl($token_url,$params); $response = explode ('=',$response); $response = explode ('&amp;',$response[1]); $response = $response[0]; return $response; } </code></pre> <p>Hope it helps.</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