Monday, April 11, 2011

How to post from facebook app to facebook page?

* NOTE :-

Please follow all the steps carefully and sequentially. Users are advised to follow every step in different tab.

For all the steps we are considering following options :-

1. FB Page :-
Name : Sample Page
{PAGE_ID} : 121364427524405

2. FB App :-
Name : Sample App
{APP_ID} : 303409109772222
{API_KEY} : 222223632fdc6ffffe4a53a453333333
{APP_SECRET} : 1111111111111115f3939c1513ee0844

3. {REDIRECT_URL} :- http:/

In order to post data from App page to other page we have to follow the following steps:-

synopsis :{APP_ID}&redirect_uri={REDIRECT_URL}&scope=email,read_stream,offline_access,manage_pages


Redirected to :-|W8_4DqYq_KCX_oBaa11oJJQ373Q

Output on redirect URL's screen :
[access_token] =} 303409109772222|60ad2f9f47cdaf5e03176824-100000098944650|xAOzhvZAJELuLgJVouW1l7nrMLQ

synopsis :{APP_ID}&redirect_uri={REDIRECT_URL}&client_secret={APP_SECRET}&code={CODE_GENERATED_IN_REDIRECT_TO_URL_IN_STEP_1}


Output on redirect URL's screen :
[access_token] =} 303409109772222|60ad2f9f47cdaf5e03176824-100000098944650|xAOzhvZAJELuLgJVouW1l7nrMLQ

synopsis :{APP_ID}&redirect_uri={REDIRECT_URL}&scope=email,read_stream&response_type=token


synopsis :{APP_ID}&client_secret={APP_SECRET}&grant_type=client_credentials


Output on redirect URL's screen :

synopsis :{APP_ID}&redirect_uri={REDIRECT_URL}&scope=manage_pages&response_type=token



* NOTE : This URL will yield the listing of all pages in JSON format. We will have to find out the ACCESS_TOKEN of that page, on which we have to post.


Output on redirect URL's screen :

{"data":[{"name":"Sample Page","category":"Media\/news\/publishing","id":"121364427524405","access_token":"303409109772222|60ad2f9f47cdaf5e03176824-100000098944650|121364427524405|LDf-47eJi-dYgjourPlz4Kp78Jg"}]}

In our case we have to post on Sample page - the first entry in our JSON string. So we will extract access_token parameter of this JSON string for future usage.

synposis :{API_KEY}&connect_display=popup&v=1.0&next={REDIRECT_URL}&cancel_url=,publish_stream,offline_access


Redirected to :-{%22session_key%22%3A%2260ad2f9f47cdaf5e03176824-100000098944650%22%2C%22uid%22%3A100000098944650%2C%22expires%22%3A0%2C%22secret%22%3A%227367a1a32dc7240e8b2fd50c48331c8a%22%2C%22sig%22%3A%22fcf7ce7683a13ffb83a4d96a2aa7f1cb%22}

curl -F 'access_token={ACCESS_TOKEN_GENERATED_FROM_STEP_6}' \
-F 'message={MESSAGE}' \
-F 'link={HYPER_LINK}' \
-F 'picture={IMAGE}' \
-F 'name={IMAGE_NAME}' \
-F 'caption={IMAGE_CAPTION}' \
-F 'description={DESCRIPTION}' \


curl -F 'access_token=303409109772222|60ad2f9f47cdaf5e03176824-100000098944650|121364427524405|LDf-47eJi-dYgjourPlz4Kp78Jg' \
-F 'message=Message \
-F 'link= \
-F 'picture=' \
-F 'name=Name \
-F 'caption=Caption \
-F 'description=Description \
-F 'actions={"name": "Caption1", "link": ""}' \

* Note: On success it will return JSON_ENCODED_STRING with post-id as id


Monday, November 22, 2010

Error while working with Zend Framework application.ini resources.layout.pluginClass = ‘xxxxxx’

Hi Folks!

I came across an interesting problem while working with Zend Framework module based implementation.

To enable module based layout I followed the very good post by Ponders.

But rather than loading class in Bootstrap.php I defined in applicatio.ini.

I made following changes in application.ini :-

resources.layout.pluginClass = 'Plugin_ModuleLayout'

Code was working fine on my machine but when my colleague checked out the version things were broken and the error message displayed was

Zend_Exception: Security check: Illegal character in filename in /path/to/Zend/library/Zend/Loader.php on line 303

After lot of head scratching I came to know that it was single-quote (') that was culprit. When I modified application.ini like

resources.layout.pluginClass = Plugin_ModuleLayout

things started working and I was able to apply module based layout.

Even we can use double quotes (") like this :-
resources.layout.pluginClass = "Plugin_ModuleLayout"

I think PHP version created some problem.

I was running PHP 5.3.2 and my colleague was working on 5.2.x.

Word of caution : Avoid use of quotes in application.ini.

Hopefully I will be able to help someone and save few precious minutes.