Photo and Me

Archive for January, 2011

My Little Ellen

by on Jan.31, 2011, under Photography

Haven’t post any photo for awhile since there is Facebook album. :) this time nothing about programming. just a new picture for little Ellen.

My little niece Ellen has grown up a lot, but she is still so small like a doll. :)

Post to Twitter Post to Plurk Post to Yahoo Buzz Post to Delicious Post to Digg Post to Facebook Post to MySpace Post to Ping.fm Post to Reddit Post to StumbleUpon

Leave a Comment :, , more...

my own Zend Facebook service

by on Jan.18, 2011, under Programming

I am building a library in Zend Framework to make my web app easier to work with Facebook. So far I have modified on Zend_Oauth and create my own Oauth library so it fits with Facebook Oauth Scheme and it seems everything working well just I haven’t put down any comments yet because i still investigate what I have missed so far.. (Zend_Oauth Library seems to have more functionality which I have omitted some functions because they seem not fitting with facebook Oauth such as Post Header method which I think I can only work on Get method, but I am still investigating on it…)
(continue reading…)

Post to Twitter Post to Plurk Post to Yahoo Buzz Post to Delicious Post to Digg Post to Facebook Post to MySpace Post to Ping.fm Post to Reddit Post to StumbleUpon

Leave a Comment :, , , more...

My note about how I test with Zend + Facebook Oauth

by on Jan.16, 2011, under Programming

This is just a note for me how I test my code to retrieve Facebook Access Token though my Zend Application since Zend_OAuth is not really useful here:

class IndexController extends Zend_Controller_Action
{

     const APP_ID = YOUR_APP_ID;
     const APP_SECRET = YOUR APP SECRET;

    public function init()
    {
        /* Initialize action controller here */
    }

      public function indexAction()
    {
       // redirect user to authorized url.  Usually you may want to make a pop up link to open this...
         $this->_helper->redirector->gotoUrl(
               'https://graph.facebook.com/oauth/authorize?client_id='.
               self::APP_ID.
               '&redirect_uri=YOUR_CALLBACK_URL');

    }

    public function oauthAction() {
        // if succuess will get 'code' parameters
        $code = $this->getRequest()->getParam('code');

        if (null !== $code)
        {
           //  This will return an access_token and expiry if success
          // $content will be 'access_token=.....&expiry=.....'
            $content = file_get_contents(
            'https://graph.facebook.com/oauth/access_token?client_id='.
            self::APP_ID.
            '&redirect_uri=YOUR_CALLBACK_URL'.
            '&client_secret='.self::APP_SECRET.
            '&code='.$code);

          //you may want to parse $content so you can retrieve access_token alone
          // Simple Test to retrieve user information
           $this->view->user = json_decode(
                                file_get_contents(
                                    'https://graph.facebook.com/me?'.
                                    $content));

        }
        else {
            // Error Code to handle.. probably user not authorize
        }

    }
}

My view script file:

User Name:  <?= $this->user->name; ?>

Just an idea. maybe should write a service to do all the procedures like Zend_Service_Twitter.

Post to Twitter Post to Plurk Post to Yahoo Buzz Post to Delicious Post to Digg Post to Facebook Post to MySpace Post to Ping.fm Post to Reddit Post to StumbleUpon

Leave a Comment :, , , , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Blogroll

A few highly recommended websites...