Showing posts with label Facebook. Show all posts
Showing posts with label Facebook. Show all posts

Tuesday, February 10, 2015

Get a Facebook API Access Token That Never Expires

Standard
I’ve been working on a few scripts that performed some minor data collection using the Facebook Graph API as a data source. Ideally, I wanted this script to be able to run several times a day automatically, however Facebook grants access tokens that expire after 1-2 hours. Since I’m the only one that is going to run this script, I only needed access to my Facebook data and I didn’t want to have to re-authenticate every few hours. Luckily, Facebook provides a permission parameter to get a “long-lived” access token from Oauth called offline_access!

https://graph.facebook.com/oauth/access_token?
client_id=_APP_ID_&
client_secret=_APP_SECRET_&
grant_type=fb_exchange_token
&fb_exchange_token=_ACCESS_TOKEN_ON_STEP_4_


Wednesday, November 26, 2014

website's content on the faebook wall Yii

Standard





post my website's content on the faebook wall. who want to share it.

<pre class="java" name="code"><div id="fb-root">
</div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-share-button" data-href="&lt;?php echo Yii::app()-&gt;theme-&gt;baseUrl;?&gt;/index.php/listings/&lt;?php echo $model-&gt;ListingId; ?&gt;" data-type="button_count" data-width="200">
</div>
&lt;!--<div class="fb-share-button" data-href="http://channasmcs.blogspot.com/2014/09/onclick-selected-value-in-input-box.html" data-type="button_count" data-width="200">
</div>
<div class="fb-share-button" data-href="https://developers.facebook.com/docs/plugins/" data-type="box_count">
</div>
</pre>