Great Minds Do Not Think Alike

Monitor Resolution

Forum Index Members Search Usergroups
Ranks Staff Statistics Forum FAQ
Board Rules Edit your profile Login, Check Messages Log in

Search for at

 
Recent Topics     
Forum Replies Last Post
Force Downloads by setting the correct mime type.
Started by Admin
PHP Uploading & Downloading 0 Mon Jul 29, 2019 6:19 am
by Admin
Facebook SDK for PHP (v5)
Started by Admin
facebook/php-graph-sdk v5 0 Mon Jul 22, 2019 9:46 pm
by Admin
Welcome to PHP-Nuke Titanium v3.0.0!
Started by Admin
Current Version 0 Tue Jul 14, 2009 12:22 am
by Admin

Facebook SDK for PHP (v5)
Post new topic Reply to topic printer-friendly view List users that have viewed this topic Thank Post Forum Index facebook/php-graph-sdk v5
View previous topic View next topic
PostPosted: Mon Jul 22, 2019 9:46 pm Reply with quote
Admin
This repository contains the open-source PHP SDK that allows you to access the Facebook Platform from your PHP app.

Installation
The Facebook PHP SDK can be installed with Composer. Run this command:

composer require facebook/graph-sdk
Please be aware, that there are issues when using the Facebook SDK together with Guzzle 6.x. php-graph-sdk v5.x only works with Guzzle 5.x out of the box. However, there is a workaround to make it work with Guzzle 6.x.

Upgrading to v5.x
Upgrading from v4.x? Facebook PHP SDK v5.x introduced breaking changes. Please read the upgrade guide before upgrading.

Usage

Note: This version of the Facebook SDK for PHP requires PHP 5.4 or greater.

Simple GET example of a user's profile.


PHP:  [ Select all ]

require_once __DIR__ '/vendor/autoload.php'// change path as needed

$fb = new \Facebook\Facebook([
 
 'app_id' => '{app-id}',
 
 'app_secret' => '{app-secret}',
 
 'default_graph_version' => 'v2.10',
 
 //'default_access_token' => '{access-token}', // optional
]);

// Use one of the helper classes to get a Facebook\Authentication\AccessToken entity.
//   $helper = $fb->getRedirectLoginHelper();
//   $helper = $fb->getJavaScriptHelper();
//   $helper = $fb->getCanvasHelper();
//   $helper = $fb->getPageTabHelper();

try {
 
 // Get the \Facebook\GraphNodes\GraphUser object for the current user.
 
 // If you provided a 'default_access_token', the '{access-token}' is optional.
 
 $response $fb->get('/me''{access-token}');
} catch(\
Facebook\Exceptions\FacebookResponseException $e) {
 
 // When Graph returns an error
 
 echo 'Graph returned an error: ' $e->getMessage();
 
 exit;
} catch(\
Facebook\Exceptions\FacebookSDKException $e) {
 
 // When validation fails or other local issues
 
 echo 'Facebook SDK returned an error: ' $e->getMessage();
 
 exit;
}

$me $response->getGraphUser();
echo 
'Logged in as ' $me->getName(); 

 
Complete documentation, installation instructions, and examples are available here.

Tests
Please login to see this link
Get registered or Log in


Please login to see this link
Get registered or Log in
is a prerequisite for running the tests. Install composer globally, then run composer install to install required files.
Create a test app on
Please login to see this link
Get registered or Log in
, then create tests/FacebookTestCredentials.php from tests/FacebookTestCredentials.php.dist and edit it to add your credentials.
The tests can be executed by running this command from the root directory:
$ ./vendor/bin/phpunit
By default the tests will send live HTTP requests to the Graph API. If you are without an internet connection you can skip these tests by excluding the integration group.

$ ./vendor/bin/phpunit --exclude-group integration
Contributing
For us to accept contributions you will have to first have signed the Contributor License Agreement. Please see CONTRIBUTING for details.

REPOSITORY LINK
Please login to see this link
Get registered or Log in


Sincerely,
Ernest Allen Buffington
813-846-2865

Site Owner

Groups Site Owner
Posts 3
Joined Jul 17, 2019
Status Offline
Gender Male
View user's profile Send Admin a private message Visit user's website Find all posts by Admin

Display posts from previous:
Post new topic Reply to topic printer-friendly view List users that have viewed this topic Thank Post All times are UTC + 10 Hours
Page 1 of 1


 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Powered by phpBB © 2001, 2019 phpBB Group
CarbinFiber Red Flames Designed By: TheGhost © 2019 The 86it Developers Network