Archive for January, 2011
My Little Ellen
by sunny 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. ![]()

my own Zend Facebook service
by sunny 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…)
My note about how I test with Zend + Facebook Oauth
by sunny 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.