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
<?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
<?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 | |
// 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 | |
// 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 | |
// 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
<div class="well"> | |
<button class="btn btn-info share-btn">Share</button> | |
</div> | |
<script type="text/javascript"> | |
function fb_share() { | |
FB.ui( { | |
method: 'feed', | |
name: "Search Google", | |
link: "https://www.google.com", |
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 | |
// post to facebook - requires publish_actions permission | |
$post = $facebook->api( "me/feed", "POST", array( | |
'message' => 'Testing custom search action', | |
'actions' => array( | |
'name' => 'Search', | |
'link' => 'http://www.google.com' | |
) | |
) ); |
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 "facebook/facebook.php"; | |
$facebook = new Facebook( array( 'appId' => APP_ID, 'secret' => APP_SECRET ) ); | |
// enable upload support | |
$facebook->setFileUploadSupport( true ); | |
// set access token for user / page here (not needed if you intend to use the login flow beforehand) |
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
var Util = { | |
is_webkit: function() { | |
return navigator.userAgent.indexOf("AppleWebKit") > -1; | |
}, | |
message: function() { | |
if ( typeof console == "object" ) { | |
if ( Util.is_webkit() ) { | |
console.log( "%cHey! What are you looking under here for?\nDeveloped by Niraj Shah http://www.webniraj.com", "color: #359AD8; font-size: 18px; font-family: 'Trebuchet MS', Helvetica, sans-serif;" ); | |
} else { | |
console.log( "Hey! What are you looking under here for?\nDeveloped by Niraj Shah http://www.webniraj.com" ); |