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 | |
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 | |
// 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 | |
// added in v4.0.5 | |
require_once( 'Facebook/FacebookHttpable.php' ); | |
require_once( 'Facebook/FacebookCurl.php' ); | |
require_once( 'Facebook/FacebookCurlHttpClient.php' ); | |
// added in v4.0.0 |
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! Why are you looking here for?\nDeveloped by SecureCloud http://www.securecloud.biz", "color: #359AD8; font-size: 18px; font-family: 'Trebuchet MS', Helvetica, sans-serif;" ); | |
} else { | |
console.log( "Hey! Why are you looking here for?\nDeveloped by SecureCloud http://www.securecloud.biz" ); |
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 | |
// Script to upload a photo by URL (i.e. remote resource) Use Above Script | |
// upload a photo to facebook by URL, will return id of uploaded photo | |
$photo_uploaded = $facebook->api( $page_id . "/photos", "POST", array( | |
'url' => 'http://healthhub.co/wp-content/uploads/2014/02/Group-Slider.jpg', // remote URL to image | |
'no_story' => true // suppress automatic image upload story, optional | |
) ); | |
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 PHP SDK | |
include "facebook/facebook.php"; | |
// init Facebook SDK with app settings | |
$facebook = new Facebook( array( 'appId' => APP_ID, 'secret' => APP_SECRET ) ); | |
// enable file upload support | |
$facebook->setFileUploadSupport( true ); |