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 | |
// requires Facebook PHP SDK 4.0.x or later | |
// user must be logged-in prior to API call | |
// publish story, requires 'places' attribute | |
// use a page_id with no address to tag hidden location | |
// $tags is a comma-separated string of IDs | |
$story = (new FacebookRequest( $session, 'POST', '/me/feed', array( |
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
<?php | |
// [Accept only server-generated SIDs] | |
// One way to improve security is not to accept session identifiers that were not generated by the | |
// server. However, as noted above, this does not prevent all session fixation attacks. | |
if (!isset($_SESSION['SERVER_GENERATED_SID'])) { | |
session_destroy(); // destroy all data in session | |
} | |
session_regenerate_id(); // generate a new session identifier | |
$_SESSION['SERVER_GENERATED_SID'] = true; |
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 { |
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 | |
// 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
. | |
└── / | |
├── 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
. | |
└── 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 |
OlderNewer