Skip to content

Instantly share code, notes, and snippets.

View niraj-shah's full-sized avatar
🏠
Working from home

Niraj Shah niraj-shah

🏠
Working from home
View GitHub Profile
@niraj-shah
niraj-shah / fb-post-extended-4.0.x.php
Created May 29, 2014 10:10
Posting to Timeline using PHP SDK 4.0.x with additional parameters
<?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'
)
@niraj-shah
niraj-shah / fb_sdk_4.0_structure.txt
Created June 7, 2014 11:19
Facebook PHP SDK 4.0.x File Structure
.
└── app
├── Facebook
│ ├── FacebookCanvasLoginHelper.php
│ ├── FacebookCurl.php
│ ├── FacebookHttpable.php
│ ├── FacebookCurlHttpClient.php
│ ├── FacebookJavaScriptLoginHelper.php
│ ├── FacebookPageTabHelper.php
│ ├── FacebookRedirectLoginHelper.php
@niraj-shah
niraj-shah / ci_fb_sdk_4.0.txt
Last active August 29, 2015 14:02
Facebook PHP SDK 4.0.x with CodeIgnitor
.
└── /
├── application
│ ├── cache
│ ├── config
│ ├── controllers
│ ├── core
│ ├── errors
│ ├── helpers
│ ├── hooks
@niraj-shah
niraj-shah / fb_tab_app_4.0.x.php
Last active January 22, 2024 11:42
Creating a Facebook Page Tab App using the Facebook PHP SDK 4.0.x
<?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' );
@niraj-shah
niraj-shah / fb_tab_app_likegate_4.0.x.php
Last active August 29, 2015 14:02
Creating a Facebook Page Tab App using the Facebook PHP SDK 4.0.x. This is a example how to create a likegate.
<?php
// include lines 1-65 from https://gist.github.com/niraj-shah/fcd17411def017e3aefc here
// see if the viewer has liked the page
if ( $pageHelper->isLiked() ) {
// see if we have a session
if ( isset( $session ) ) {
// show logged-in user id
@niraj-shah
niraj-shah / fb_sdk_4.0.8.php
Last active October 22, 2024 02:31
Facebook PHP SDK v4.0.8 Class Changes
<?php
// Facebook PHP SDK v4.0.8
// path of these files have changes
require_once( 'Facebook/HttpClients/FacebookHttpable.php' );
require_once( 'Facebook/HttpClients/FacebookCurl.php' );
require_once( 'Facebook/HttpClients/FacebookCurlHttpClient.php' );
require_once( 'Facebook/Entities/AccessToken.php' );
@niraj-shah
niraj-shah / tag_store.php
Created June 12, 2014 19:35
Using a ID from taggable_friends to post Status Update using Graph API 2.0 and Facebook PHP SDK 4.0.x
<?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(
@niraj-shah
niraj-shah / index.php
Created June 24, 2014 17:41
PHP file to redirect visitors to iOS or Android app files
<?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" );
@niraj-shah
niraj-shah / parse-pointers.php
Created July 3, 2014 12:22
Parse.com PHP SDK - Using Pointers and ACL
<?php
require_once( 'Parse/parse.php' );
// User ID from User table
$user_id = 'QLaLLqjJWi';
// new Profile object
$parse = new parseObject('Profile');
// set DOB as date - uses strtotime
@niraj-shah
niraj-shah / parse-pointers.js
Created July 3, 2014 12:39
Parse.com JavaScript SDK - Using Pointers and ACL
// new Profile object
var Profile = Parse.Object.extend("Profile");
var profile = new Profile();
// set DOB as date - needs to be ISO format
var dob = new Date("1985-01-01");
profile.set( 'dob', { "__type": "Date", "iso": dob.toISOString() } );
// bio string data
profile.set( 'bio', 'I am a PHP developer' );
// pointer to User table (parse Classes should have _ prefix.)