PHP code example of codeurs / social-feed

1. Go to this page and download the library: Download codeurs/social-feed library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

codeurs / social-feed example snippets


$feed = new SocialFeed();

// Input api credentials
$feed->facebook->setCredentials([
  'app_id' => '__',
  'app_secret' => '__'
]);

// Get all recent posts for user 'codeurs.be'
$data = $feed->facebook->getFeed('codeurs.be');
foreach ($data as $item) {
  // ...
}

// Get a single facebook post
$item = $feed->facebook->getItem('646338148755451_704084252980840');

// Get an id or item from a facebook url
$id = $feed->facebook->getIdFromUrl('https://www.facebook.com/_/photos/_/?type=1&theater');
$item = $feed->facebook->getItemFromUrl('https://www.facebook.com/_/photos/_/?type=1&theater');