Get latest post from facebook page (feed)
<p>I'm trying to get the latest facebook post from a facebook page. I'm working with the <strong>facebook php SDK v4</strong> (<a href="https://github.com/facebook/facebook-php-sdk-v4/" rel="nofollow">https://github.com/facebook/facebook-php-sdk-v4/</a>).</p>

<p>I've added the library (php sdk) to composer: <code>composer require facebook/php-sdk-v4</code>. My appid / app secret and page id are correct.</p>

<pre><code>$config = array();
$config['app_id'] = 'myappid';
$config['app_secret'] = 'myappsecret';

$facebook = new \Facebook\Facebook($config);

$pageid = 'mypageid';

try {

    $pagefeed = $facebook-&gt;api("/" . $pageid . "/feed");
}
catch(Exception $ex){
    echo $ex-&gt;getMessage(); die;
}
</code></pre>

<p>The problem is I'm getting the error <strong>Call to undefined method Facebook\Facebook::api()</strong>. When I search in other topics online they've used this a lot. But what am I doing wrong?</p>