learningtech
learningtech

Reputation: 33695

How to tell which facebook version API i'm using in php

I have an old php project from about two years ago. I see that I downloaded the facebook php SDK version 3.1.1.

When I installed my project, I see the PHP facebook object make a call to /me/friends?access_token=longadfjoaisdfjoaije which then prints all my friends.

I've read lots of discussion that facebook graph v2.0 and onwards will no longer disclose all the friends unless the friends are also using the app/project I made and explicitely agree to some instructions.

So i'm trying to confirm if my FB SDK is connecting to a graph api less than 2.0. But I can't tell. My guess is that i'm using less than 2.0 because i'm seeing all my friends in the api response. I tried digging through the SDK code but I don't see anywhere the disclosure of which graph api version I'm using. Does anyone know how I determine which graph version I'm using via the 3.1.1 version of Facebook SDK?

Thanks

Upvotes: 3

Views: 2908

Answers (1)

zerkms
zerkms

Reputation: 254926

That's correct, Facebook PHP SDK v3.1.1 uses Graph API v < 2.0 uses < v2.0 if was created before API v2 was introduced, otherwise the API v2 is used (as stated at How to tell which facebook version API i'm using in php)

You can get it from the code:

The old SDK does not add a version number https://github.com/facebook/facebook-php-sdk/blob/master/src/base_facebook.php#L1185

Whereas the new one adds it explicitly https://github.com/facebook/facebook-php-sdk-v4/blob/4.0-dev/src/Facebook/FacebookRequest.php#L216

  protected function getRequestURL()
  {
    return static::BASE_GRAPH_URL . '/' . $this->version . $this->path;
  }

where $this->version is assigned to const GRAPH_API_VERSION = 'v2.0';

Upvotes: 5

Related Questions