2 Get in touch via Contact Form
3 Talk to our LIVE CHAT Support

If you still have problems, please let us know, by sending an email to support@webnextech.com or call 020-3289-4324 . Thank you!


Mon-Fri 9:00AM - 7:00PM
Sat - 9:00AM-2:00PM
Sundays by appointment only!

Auto post to Facebook

Social websites like facebook plays a vital role in increasing traffic for any website. So posting events of your website like new registration,new scheme etc on your facebook fan page will let others know about it and eventually increase traffic and income.

The Facebook Graph Api allows websites to interact with Facebook users. In order to post status updates, we first need to create a facebook app.This is how an app is creating on facebook.

Go to the Developers area of Facebook and click Apps->Create New App.In the popup enter app name, click continue and submit after filling captcha. Your new app is created and you will be directed to the new app page.Please note down App id and App secret,shown at the top of the page.It will be required a little later for integration.Fill up the details and click “App on Facebook”  tab and in the Canvas URL and Secure Canvas URL enter a URL to a script on your web server. In this script put the following:


Now we need to set up permissions for the app to post on our behalf. Load the following URL in your browser:


app_id = Application ID (The one which we saved above)
redirect_url = Canvas URL (Facebook Integration Tab)

This will give your app full access to your feed and your pages. The offline_access priviledge will make it so we don’t have to re-authenticate every time we want to post.

After you confirm the app access to your account it should redirect back to your canvas URL script. The canvas URL script should output the GET array which should have a “code” variable. Take the code value and plug it into this URL:


app_id = Application ID
redirect_url = Canvas URL (Facebook Integration Tab)
code_string = code from last URL response

This will output an access token variable. This token will allow us to post to our feed.

please download Facebook PHP SDK.

Now we should write php code using all parameters got so far.Please use a separate php page for this.

// Include facebook class (make sure your path is correct)
// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array( 'appId' => 'app_id',
'secret' => 'app_secret',
'cookie' => true,
//$token is the access token from the URL above
$post = array('access_token' => $token, 'message' =>'any message','name' => 'name','description'=> 'description','picture' => imageurl,'link'=>'http://yourlink','caption' =>'caption');
$res = $this->tasks->api('/me/feed','POST',$post);
} catch (Exception $e){
echo $e->getMessage();

This will post a message to your feed. Remember to replace the app_id and app_secret with the info from your app.

You may be an admin of a fan page and want to post as the fan page and not yourself. To do this we just need to take one extra step and get a different access token. Load the following URL:


Where token is the access token from above. This will output a new access token for each of the pages you have admin access to. Use this token to post as your fan page instead of yourself and replace “me” to “page_username_id” in the above url: $res = $this->tasks->api(‘/me/feed’,’POST’,$post);   other things remain same.

Similarly you can post to your friends feed .For this again just replace “me” with “friend_username_id” in the above $res url.

Recently in 2012 Facebook has decided to remove the offline_access permission and has introduced a concept called long-lived access tokens which last a maximum of 60 days.

In order to extend the access token you need to make the following request with your short lived access token:


where EXISTING_ACCESS_TOKEN is what we used above. So once we get another token by using this url we need to replace previous token with this token in the above script