Get Facebook Feeds in Json Format

How to get facebook feeds in json format to display on you website?

we can easily get feeds but if we need to display in desired format then we need this in JSON format. For this we need to follow the steps below.

  1. Login To your Facebook account and open https://developers.facebook.com/apps/  in new tab and click on  Add a new app.
  2. Choose platform as website, second name your app, third click on add facebook app id and select category as Apps for Pages .
  3. Add the website url as the website where you want to add these feeds.
  4. Now you can skip to development dashboard. You can see your app ID and app Secret code.
  5. Fill the details App domain, contact email and other thing. ( keep the app domain same as the website url ).
  6. Now get your page ID by http://findmyfbid.com/ (write the url of your page.)
  7. Get auth Token by your app as $authToken = file_get_contents(“https://graph.facebook.com/oauth/access_token?type=client_cred&client_id={$appID}&client_secret={$appSecret}”);
  8. Get your Facebook page feeds $data = file_get_contents(“https://graph.facebook.com/{$facebookpageID}/feed?fields=posts,attachments,created_time&{$authToken}”);
  9. The value you get as $data will be the feeds in json format.

Enjoy your facebook page feeds .
There are so many things we can do in Facebook page . For more you can ask it in comment.

Listing Tables name in CakePHP

We can use the following code in listing the tables name or checking the existence of a table in database using cakePHP.

In CakePHP 2.X versions.

  1. Add ” App::uses(‘ConnectionManager’, ‘Model’); ” in the controller in which you want to process the list. You have to add this code before defining the class controller.
  2. ” $tables= ConnectionManager::getDataSource(‘default’)->listSources(); “. Now $tables will be the list of exist tables in database.

In CakePHP 3.X versions.

  1. Add ” use Cake\Datasource\ConnectionManager;  ” in the controller in which you want to process the list. You have to add this code before defining the class controller.
  2. ” $tables = ConnectionManager::get(‘default’)->schemaCollection()->listTables(); “. Now $tables will be the list of exist tables in database.

 

Get Instagram Feeds in Json Format

How to get instagram feeds in json format to display on you website?

we can easily get feeds but if we need to display in desired format then we need this in JSON format.  Follow the steps below.

  1.  Login to Instagram account (which account’s feed you want to retrieve) and go to “https://instagram.com/developer/clients/manage/“.
  2. Now click on “Register a client” and add ‘Website URL’ & ‘Valid redirect URIs’ as your website where you want to show Instagram feeds.
  3. You will get a client ID and client secret code. Now you need to get the access token to continue.
  4. To get access token you have to hit the url “https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=code“.  (CLIENT-ID -> you have this id, REDIRECT-URI -> you have this url)
  5. After this you will get the access token.
  6. Now you can get all Json feeds $feeds = file_get_contents(‘https://api.instagram.com/v1/users/USER-ID/media/recent?client_id=CLINT-ID&access_token=ACCESS-TOKEN‘);
  7. Best of Luck. You can use these Json fields as you want.