title: Error when making a GET request to Facebook using Facebook's PHP SDK
body: <p>I've been trying to work out how to send a Facebook notification using their latest PHP SDK for almost a week now, but I can't seem to get it to work. I've tried everything I could find online but I keep running into errors.
  So I decided to try a simple GET request using PHP instead.
  To do this I'm trying to use the sample code Facebook gives here:</p>
  
  <p><a href="https://developers.facebook.com/docs/php/FacebookRequest/5.0.0" rel="nofollow">https://developers.facebook.com/docs/php/FacebookRequest/5.0.0</a></p>
  
  <p>This is the code I'm trying:
  (I've replaced my App ID and App Secret here)</p>
  
  <pre><code>&lt;?php
  require_once __DIR__ . '/facebook-sdk-v5/autoload.php';
  
  $fbApp = new Facebook\FacebookApp('123456789', 'a1b2c3d4e5f6g7h8i9');
  $request = new Facebook\FacebookRequest($fbApp, '123456789|a1b2c3d4e5f6g7h8i9', 'GET', '/me');
  
  // OR
  //$fb = new Facebook\Facebook(/* . . . */);
  //$request = $fb-&gt;request('GET', '/me');
  
  // Send the request to Graph
  try {
    $response = $fbApp-&gt;getClient()-&gt;sendRequest($request);
  } catch(Facebook\Exceptions\FacebookResponseException $e) {
    // When Graph returns an error
    echo 'Graph returned an error: ' . $e-&gt;getMessage();
    exit;
  } catch(Facebook\Exceptions\FacebookSDKException $e) {
    // When validation fails or other local issues
    echo 'Facebook SDK returned an error: ' . $e-&gt;getMessage();
    exit;
  }
  
  $graphNode = $response-&gt;getGraphNode();
  
  echo 'User name: ' . $graphNode['name'];
  ?&gt;
  </code></pre>
  
  <p>This isn't working, it's giving me the error:</p>
  
  <blockquote>
    <p><b>Fatal error</b>:  Call to undefined method Facebook\FacebookApp::getClient() in <b>/home/mywebsite/public_html/Games/Barre/phptest.php</b> on line <b>15</b></p>
  </blockquote>
  
  <p>I don't understand what's wrong, I think I'm following Facebook's documents correctly, but it's not working. It seems to be saying that <code>getClient()</code> isn't included in the <code>facebook-sdk-v5</code> files I've included at the start. I've made sure that I'm pointing to the correct directory for the files and they're all present and correct in that folder (<code>facebook-sdk-v5</code>). Can anyone here can see where I'm going wrong?</p>
  
  <p>I'd really appreciate any advice on how to solve this. Thank you in advance!</p>
  
  <p><strong>UPDATE</strong></p>
  
  <pre><code>&lt;?php
  require_once __DIR__ . '/facebook-sdk-v5/autoload.php';
  
  //    $fbApp = new Facebook\FacebookApp('123456789', 'a1b2c3d4e5f6g7h8i9');
  //    $request = new Facebook\FacebookRequest($fbApp, '123456789|a1b2c3d4e5f6g7h8i9', 'GET', '/me');
  
  // OR
  
   $fb = new Facebook\Facebook([
    'app_id' =&gt; '{123456789}',
    'app_secret' =&gt; '{a1b2c3d4e5f6g7h8i9}',
    'default_graph_version' =&gt; 'v2.3',
    'default_access_token' =&gt; '{123456789|a1b2c3d4e5f6g7h8i9}',
    ]);
  
  $request = $fb-&gt;request('GET', '/me');
  
  // Send the request to Graph
  try {
    $response = $fb-&gt;getClient()-&gt;sendRequest($request);
  } catch(Facebook\Exceptions\FacebookResponseException $e) {
    // When Graph returns an error
    echo 'Graph returned an error: ' . $e-&gt;getMessage();
    exit;
  } catch(Facebook\Exceptions\FacebookSDKException $e) {
    // When validation fails or other local issues
    echo 'Facebook SDK returned an error: ' . $e-&gt;getMessage();
    exit;
  }
  
  $graphNode = $response-&gt;getGraphNode();
  
  echo 'User name: ' . $graphNode['name'];
  ?&gt;
  </code></pre>
  
  <p>Error in console:</p>
  
  <blockquote>
    <p>Graph returned an error: Invalid OAuth access token signature</p>
  </blockquote>
  
  <p><strong>2nd UPDATE</strong></p>
  
  <p>This code is working correctly:</p>
  
  <pre><code>&lt;?php
  
  require_once __DIR__ . '/facebook-sdk-v5/autoload.php'; 
  
  $fb = new Facebook\Facebook([
    'app_id' =&gt; '{123456789}',
    'app_secret' =&gt; '{a1b2c3d4e5f6g7h8i9j}',
    'default_graph_version' =&gt; 'v2.3',
    ]);
  
  $request = $fb-&gt;post('/USERIDGOESHERE/notifications', array( 'template' =&gt; 'This is a test notification!'), '123456789|a1b2c3d4e5f6g7h8i9j');
  
  ?&gt;
  </code></pre>