Facebook Adding an App to a Page


Hits: 6303  

You can provide App to Fan Page Tab using URL, but you must check below options to get App (Page Tab) Added Page ID?

https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&next=YOUR_URL

After successful authorization users will redirect to your Site URL with pageID

http://www.domain.com/?tabs_added[pageID]=1#_=_

App Page Tab Settings
App Page Tab Settings
Add Page Tab Dialog
Add Page Tab Dialog

Integrating with Facebook APIs

When a user selects Page Tab and authorize your application, you receive the signed_request parameter with one additional parameter, page.

JSON object
id (the page id of the current page)
admin (if the user is a admin of the page)
liked (if the user has liked the page).

Option 1: Canvas Page
$signedRequest = $facebook->getSignedRequest();

Option 2: App Domain / Site URL
if(array_key_exists(‘tabs_added’, $_REQUEST)) {
$id = array_keys($_REQUEST[‘tabs_added’]);
$pageId = $id[0];
echo $pageId;
}

Option 3: Page Tab URL
if (!empty($_REQUEST[‘signed_request’])) {
list($encodedSig, $payload) = explode(‘.’, $_REQUEST[‘signed_request’], 2);
$requestData = json_decode(base64_decode(strtr($payload, ‘-_’, ‘+/’)), true);
if (!empty($requestData[‘page’]) && isset($requestData[‘page’][‘id’])) {
$pageId = $requestData[‘page’][‘id’];
echo $pageId;
}
}

Option 4: App Domain / Site URL

<div id='fb-root'></div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src='http://connect.facebook.net/en_US/all.js'></script>
<p><a onclick='addToPage(); return false;'>Add to Page</a></p>
<p id='msg'></p>

<script> 
  FB.init({appId: "APP_ID", status: true, cookie: true});

   function addToPage() {

  // calling the API ...
  FB.ui(
    {
        method: 'pagetab'
    },
    function(response) {
        if (response != null && response.tabs_added != null) {

            $.each(response.tabs_added, function(pageid) {
                  alert(pageid);
            });
        }
    }
  );


  }

</script>

Your app will also receive string parameter app_data as part of signed_request if app_data parameter was set in the original query string in the URL your tab is loaded on.

“https://www.facebook.com/YourPage?v=app_APP_ID&app_data=STRING”

PHP Colorize an image using GD


Hits: 2906  

I was working for color customization for HTML5 MP3 Player with Playlist

Finally, I have time saving code for you PHP Colorize an image using GD

<?php

//print_r(html2rgb("#ffffff"));
//echo rgb2html(137, 113, 79); 

$color=isset($_REQUEST['color'])?$_REQUEST['color']:"ff00ff";
$image=isset($_REQUEST['image'])?$_REQUEST['image']:"2.jpg";

$rgb= html2rgb("#".$color);

$imgname=$image;
         
    $im=imagecreatefromjpeg($imgname);
    if($im&& imagefilter($im, IMG_FILTER_COLORIZE,$rgb[0],$rgb[1],$rgb[2]))
    {
         
         header("Content-Type: image/jpeg");
         imagejpeg($im);
         
         //imagejpeg($im, 'output.jpg'); 
         //imagedestroy($im); 
    }
   else
   {
        echo'Processing failed.';
   }
   

function rgb2html($r,$g=-1,$b=-1)
{
    if(is_array($r)&&sizeof($r)==3)
        list($r,$g,$b)=$r;

    $r=intval($r);$g=intval($g);
    $b=intval($b);

    $r=dechex($r<0?0:($r>255?255:$r));
    $g=dechex($g<0?0:($g>255?255:$g));
    $b=dechex($b<0?0:($b>255?255:$b));

    $color=(strlen($r)<2?'0':'').$r;
    $color.=(strlen($g)<2?'0':'').$g;
    $color.=(strlen($b)<2?'0':'').$b;
    return'#'.$color;
}

function html2rgb($color)
{
    if($color[0]=='#')
        $color=substr($color,1);

    if(strlen($color)==6)
        list($r,$g,$b)=array($color[0].$color[1],$color[2].$color[3],$color[4].$color[5]);
    elseif(strlen($color)==3)
        list($r,$g,$b)=array($color[0].$color[0],$color[1].$color[1],$color[2].$color[2]);
    else
        returnfalse;

    $r=hexdec($r);$g=hexdec($g);$b=hexdec($b);

    returnarray($r,$g,$b);
}

   
   
?>

The above code will work for JPG image files, you can optimize for other image formats 😉

=>

Content with Spinners for SEO


Hits: 2519  

Article / Content Spinning is a search engine optimization technique to provide unique relevant content on sites / blogs. Spinning is a process for rewriting existing articles.

If the original articles are plagiarized and used without the permission of copyright owner, Spinning produce multiple versions of original writing to protect contents being copied to other sites in different format.

SEO Expert believe that Content Spinner is good option for fresh and unique content on websites, Think! if you have different title, different summary and different article body then Google’s content filter might approve your article submissions and backlinks. 🙂

Article spinning can be used to produce article variations from one SEED Article, so many SEO Experts use spun articles for off site promotional efforts.

Article Spinning Content

http://demo.svnlabs.com/spinner/spin.txt

{{WOAAH!||VVOAAH}} {{I||l}} {{cant||can’t}} believe that {{you||u}} can {{actually||actualy}} {{see||check}} who {{is||ls}} {{viewing||checking}} {{your||ur}} {{profile!||profille}} {{I||l}} just {{checked||saw}} my top 10 viewers and {{Im||lm}} Shocked at WHO is still viewing it! You can also {{see||check it}} here –> http://demo.svnlabs.com/spinner/

Article Spinners use PHP functions like:

1. String Based Functions
2. Pattern Based Function

$pattern = “/{[^}]*}/”;
$subject = $fullstring;

preg_match_all($pattern, $fullstring, $matches);

Facebook Application Development with Graph API Cookbook


Hits: 2847  

Facebook Application Development with Graph API Cookbook is written by Shashwat Srivastava, Apeksha Singh for Facebook developers ranging from novice to expert. It uses PHP, HTML and jQuery, the most commonly used platforms, to build applications in Facebook.

Facebook Application Development with Graph API Cookbook

Learn from this book:

  • Install Facebook PHP SDK and register your Facebook application
  • Obtain access token and perform session validation for current Facebook user
  • Work with the newly launched Facebook Graph API
  • Get an insight into the core of Facebook application development such as creating a post on wall, publishing pictures, tagging users, etc
  • Connect to Facebook Social Graph by using Facebook PHP and JavaScript SDKs
  • Leverage Facebook Query Language in order to obtain complex Facebook user data
  • Use Facebook Dialogs to enhance user experience
  • Power your websites with Facebook Social Plugins
  • Define your website content to Facebook Graph using Facebook Open Graph Protocol
  • Handle transactions through Facebook Credits
  • Use XFBML tags to enrich your application
  • Extract Facebook application analytics data
  • Create your own applications, from tip to toe, with ready to use code

Get your copy here… http://www.packtpub.com/facebook-application-development-with-graph-api-cookbook/book

Facebook Application Development PHP SDK 3.1.1


Hits: 3437  

Facebook is going to upgrade Developer API by 1st October 2011. All sites and apps on Facebook will migrate to OAuth 2.0 through this update. This will ensure that users browsing Facebook over HTTPS will have a great experience over a secure connection. We can imagine that these changes will make facebook better and more secure while browsing apps.

Reminder- Upgrade Your App to OAuth 2.0 and HTTPS by October 1st

Today I get this notification from facebook 🙁
We can upgrade existing FB Apps created using old version of SDK see here

Code sample for FB Login Button / Link
Upgrade Your App to OAuth 2.0 and HTTPS

Code sample for FB publish & get user information
Upgrade Your App to OAuth 2.0 and HTTPS

Review Demo App using PHP SDK 3.1.1
Upgrade Your App to OAuth 2.0 and HTTPS

Login to App
Upgrade Your App to OAuth 2.0 and HTTPS

Advanced permission for App with PHP SDK 3.1.1

Upgrade Your App to OAuth 2.0 and HTTPS

Updates posted on wall using PHP SDK 3.1.1

Upgrade Your App to OAuth 2.0 and HTTPS

Get more help here: FBTerminal or discuss here skype: svnlabs 🙂

Upgrade Your App to OAuth 2.0 and HTTPS by October 1st


Hits: 4455  

Reminder- Upgrade Your App to OAuth 2.0 and HTTPS by October 1st

Facebook is going to upgrade Developer API by 1st October 2011. All sites and apps on Facebook will migrate to OAuth 2.0 through this update. This will ensure that users browsing Facebook over HTTPS will have a great experience over a secure connection. We can imagine that these changes will make facebook better and more secure while browsing apps.

Upgrading by 1st October

All websites and canvas apps must support OAuth 2.0.
All Canvas and Page Tab Apps must use the signed_request parameter.
SSL Certificate is required for all Canvas and Page Tab apps.
Users can not use Sandbox mode and not FBML.
Previous versions of our SDKs will stop working.

How to migrate to OAuth 2.0

Implementing the OAuth 2.0 authentication system.
Use latest SDKs – PHP SDK v.3.1.1.
Enable the Encrypted Access Token migration in the Developer App to use the encrypted access token.
Canvas Apps must verify that your app is using the signed_request parameter.

Reminder: Upgrade Your App to OAuth 2.0 and HTTPS by October 1st. In May we announced that all apps on Facebook need to support OAuth 2.0 and HTTPS to make the platform more secure.

All apps, including page tab apps, must migrate to OAuth 2.0 for authentication. The old SDKs, including the old JavaScript SDK (FeatureLoader.js) and old iOS SDK (facebook-iphone-sdk) will no longer work. In addition, non-iframe Canvas and Page Tab apps must support HTTPS and provide a secure canvas or secure page tab URL.

If you haven’t already made these changes, visit the Developer Roadmap before October 1st for more information about how to upgrade your app and avoid having it disabled.
You can also seek support in the Facebook Developer Group: https://www.facebook.com/groups/fbdevelopers/

Get more help here: FBTerminal or discuss here skype: svnlabs 🙂

Exceptions with Facebook Apps


Hits: 4201  

OAuthException: Error validating access token: Session has expired at unix time 1311357600. The current unix time is 1311357734

Request FB Access Token each & every time…

Rotate Apps…


OAuthException: (#1) An unknown error occurred

Sometime facebook block App’s domain and text, images, links etc. used on apps, You can use URL Linter to cross check

https://developers.facebook.com/tools/lint?url=svnlabs.com

http://forum.developers.facebook.net/viewtopic.php?id=78958 🙁

Provide UTF8 Content…


OAuthException: (#210) User not visible

The actual error is “Your friend do not allow posts on his wall”


OAuthException [message] => (#341) Feed action request limit reached


OAuthException: (#100) The post’s links must directly to the application’s connect or canvas URL

This can be solved by going into application settings -> advanced -> and setting the Stream post URL security to disabled.


Use JavaScript API to get user’s real country / location…


Add valid conditions before publishing…


I learned from Facebook…

1. Build stuff that will get used. Fast.
2. Engineering Innovation
3. Small Team, Big Impact
4. Connecting the World
5. Prime Time Hack


RoadMap
*******
Keep yourself updated with all latest changes on FB API 😉

http://developers.facebook.com/roadmap/

iWishYou – My Best Wishes with MP3 on Facebook


Hits: 2922  

My Best Wishes with MP3 on Facebook

iWishYou is a facebook application where you can share Wishes / Greeting as songs for friend’s birthday, events, daily wishes.

A wish is a hope or desire for something, iWishYou attract users with nice share on FB Walls. It is the better way to express your emotions to your friends & circle.

My Best Wishes with MP3 on Facebook

I have Cloud Power


Hits: 3812  
Amazon Web Services

AWS is an IaaS platform and provides maximum freedom for developers in choice of the OS, middleware and development environment.
Google App Engine + Google Apps

Google App Engine is used as SaaS, it provides free limited resources (disk space and bandwidth), GAE supports programming languages – PHP, Python and Java.

Facebook

Nothing to explain it is the place where (almost all) clients live with sharing content.

Rackspace

Rackspace is like Amazon cloud in IaaS and cost is quite reasonable.

Scalr.net


Scalr will provision new servers on-the-fly to handle spikes in demand, and decommission them when no longer needed to lower cost.. then your website and web application can grow to millions of users with little work.

RightScale


Cloud Computing Management Platform…Join thousands of companies managing their applications in the cloud with RightScale.

IBM Cloud

IBM Cloud is used in large companies and resource-intensive processes for managing software development, testing, storage and processing of huge data.

VMWare vCloud

VMWare Cloud is leader in virtualization.

Force.com

Force.com is provider of SaaS applications. Salesforce allows to create system and independent cloud applications.

Ghost Cloud

It provides private hard disk across the Internet for your files from any computer or cell phone and world-class backup and security.

Glide Cloud

Force.com is provider of SaaS applications. Salesforce allows to create system and independent cloud applications.

ZeroPC

Any Browser + Cloud Computing + Pay-As-You-Go = ZeroPC.

eyeOS

eyeOS have Ubiquity, Flexibility, Integration, Simplicity, Collaboration, Privacy, Security, Low Costs.

AirSet

AirSet – Share with Facebook Friends, Coordinate Schedules, Store & Back Up Files, Sync to Mobile Devices, Work from Anywhere.

My Gladinet Drive

Get PID from FBID


Hits: 6592  
<?php

include("lib/facebook.php");

$APPLICATION_ID = "xxxxxxxxxxxxxxx";
$APPLICATION_SECRET = "yyyyyyyyyyyyyyyyyyyyyyyyyyyy";

$facebook = new Facebook(array(
'appId'  => $APPLICATION_ID,
'secret' => $APPLICATION_SECRET,
'cookie' => true
));

$fbid="xxxxxxxxxx";

$fql = "SELECT pid FROM photo WHERE object_id=".$fbid;

$param  =   array(
 'method'    => 'fql.query',
 'query'     => $fql,
 'callback'  => ''
);

$fqlResult   =   $facebook->api($param);

$fql = "SELECT src_small, src_big  FROM photo WHERE pid = '".$fqlResult[0]['pid']."' ";

$param  =   array(
 'method'    => 'fql.query',
 'query'     => $fql,
 'callback'  => ''
);

$fqlResult   =   $facebook->api($param);

echo $fqlResult[0]['src_big'];
print_r(getimagesize($fqlResult[0]['src_big']));

echo "http://www.facebook.com/photo.php?fbid='".$fbid."' ";

?>

Life is the art of drawing without an eraser.So be careful while taking any small decisions about the valuable pages of life.