How To Connect Graph Api v2.1 with Old Facebook PHP SDK

Normally people who was created his Facebook apps before april 2012 used PHP SDK 3.2.The PHP sdk 3.2 has only two files and now PHP SDK 4.0 has number of files to handle graph api.
Some people has updated his app functionality with PHP SDk 4.0 but some people don’t want to update his PHP SDK. He just want to use graph api 2.1 with old sdk. PHP sdk 3.2 used graph api non-versioning manner that’s means he does not mention version number in his graph api request, The sample request of old sdk is below:

Select Code
1
https://graph.facebook.com/me/

When user does not mentioned graph version on his request then Facebook used old version of his garph api.

How to used api version with old API:

we need add version number on graph url like below on base_facebook.php library file:

Select Code
1
2
3
4
5
public static $DOMAIN_MAP = array(
    'graph'       => 'https://graph.facebook.com/v2.1/',
    'graph_video' => 'https://graph-video.facebook.com/v2.1',
    'www'         => 'https://www.facebook.com/',
  );

New request would be:

Select Code
1
https://graph.facebook.com/v2.1/me/

I hopes it help you.