简体   繁体   English

如何判断我在php中使用哪个facebook版API

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

I have an old php project from about two years ago. 我大约两年前有一个旧的PHP项目。 I see that I downloaded the facebook php SDK version 3.1.1. 我看到我下载了facebook php SDK 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. 当我安装我的项目时,我看到PHP facebook对象打电话给/me/friends?access_token=longadfjoaisdfjoaije然后打印我的所有朋友。

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. 我已经阅读了很多关于Facebook图形v2.0及以后将不再透露所有朋友的讨论,除非朋友们也在使用我制作的应用程序/项目,并且明确同意某些说明。

So i'm trying to confirm if my FB SDK is connecting to a graph api less than 2.0. 所以我想确认我的FB SDK是否连接到小于2.0的图形api。 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. 我的猜测是我使用的不到2.0,因为我在api响应中看到了所有的朋友。 I tried digging through the SDK code but I don't see anywhere the disclosure of which graph api version I'm using. 我尝试挖掘SDK代码,但我没有看到我正在使用哪个图形api版本的披露。 Does anyone know how I determine which graph version I'm using via the 3.1.1 version of Facebook SDK? 有谁知道我如何通过3.1 SDK版本的Facebook SDK确定我使用的图形版本?

Thanks 谢谢

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 ) 这是正确的,Facebook PHP SDK v3.1.1 使用Graph API v <2.0 使用<v2.0,如果是在引入API v2之前创建的,否则使用API​​ v2( 如何告诉我正在使用哪个facebook版本API)在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 旧SDK不添加版本号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 而新的明确添加它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'; 其中$this->version分配给const GRAPH_API_VERSION = 'v2.0';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM