This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// turn this: | |
$request = new FacebookRequest( $session, 'GET', '/me' ); | |
$response = $request->execute(); | |
$graphObject = $response->getGraphObject(); | |
// into this: | |
$graphObject = (new FacebookRequest( $session, 'GET', '/me' ))->execute()->getGraphObject()->asArray(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
require_once( 'Facebook/FacebookSession.php' ); | |
require_once( 'Facebook/FacebookRedirectLoginHelper.php' ); | |
require_once( 'Facebook/FacebookRequest.php' ); | |
require_once( 'Facebook/FacebookResponse.php' ); | |
require_once( 'Facebook/FacebookSDKException.php' ); | |
require_once( 'Facebook/FacebookRequestException.php' ); | |
require_once( 'Facebook/FacebookAuthorizationException.php' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// include code from https://gist.github.com/niraj-shah/ab1c74ad83df172e6075 | |
// generate login url with scope, each permission as element in array | |
$loginUrl = $helper->getLoginUrl( array( 'email', 'user_friends' ) ); | |
// output login link | |
echo '<a href="' . $loginUrl . '">Login</a>'; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// make api call | |
$response = (new FacebookRequest( | |
$session, 'POST', '/me/feed', array( | |
'message' => 'testing' | |
) | |
))->execute()->getGraphObject()->asArray(); | |
// output response - should include post_id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// make api call | |
$response = (new FacebookRequest( | |
$session, 'POST', '/me/feed', array( | |
'name' => 'Facebook API: Posting a Status Update Using PHP SDK 4.0.x', | |
'caption' => "I'm rewriting old tutorials to work with the new PHP SDK 4.0 and Graph API 2.0.", | |
'link' => 'https://www.webniraj.com/2014/05/29/facebook-api-p…-php-sdk-4-0-x/', | |
'message' => 'Check out my new tutorial' | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
└── app | |
│ ├── FacebookCanvasLoginHelper.php | |
│ ├── FacebookCurl.php | |
│ ├── FacebookHttpable.php | |
│ ├── FacebookCurlHttpClient.php | |
│ ├── FacebookJavaScriptLoginHelper.php | |
│ ├── FacebookPageTabHelper.php | |
│ ├── FacebookRedirectLoginHelper.php |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
└── / | |
├── application | |
│ ├── cache | |
│ ├── config | |
│ ├── controllers | |
│ ├── core | |
│ ├── errors | |
│ ├── helpers | |
│ ├── hooks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// required Facebook PHP SDK v4.0.9 or later. | |
// include required files form Facebook SDK | |
require_once( 'Facebook/HttpClients/FacebookHttpable.php' ); | |
require_once( 'Facebook/HttpClients/FacebookCurl.php' ); | |
require_once( 'Facebook/HttpClients/FacebookCurlHttpClient.php' ); | |
require_once( 'Facebook/Entities/AccessToken.php' ); | |
require_once( 'Facebook/Entities/SignedRequest.php' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) { | |
$iPod = stripos( $_SERVER['HTTP_USER_AGENT'], "iPod" ); | |
$iPhone = stripos( $_SERVER['HTTP_USER_AGENT'], "iPhone" ); | |
$iPad = stripos( $_SERVER['HTTP_USER_AGENT'], "iPad" ); | |
$Android = stripos( $_SERVER['HTTP_USER_AGENT'], "Android" ); | |
$webOS = stripos( $_SERVER['HTTP_USER_AGENT'], "webOS" ); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
if (isset($_SESSION['screen_width']) AND isset($_SESSION['screen_height'])) { | |
echo 'User resolution: ' . $_SESSION['screen_width'] . 'x' . $_SESSION['screen_height']; | |
} else if(isset($_REQUEST['width']) AND isset($_REQUEST['height'])) { | |
$_SESSION['screen_width'] = $_REQUEST['width']; | |
$_SESSION['screen_height'] = $_REQUEST['height']; | |
header('Location: ' . $_SERVER['PHP_SELF']); | |
} else { |