Posting a status update to Facebook for a business from the business' website

I'm hoping to be able to write code for a client's website that posts a status update to Facebook on their business Facebook page. Can anyone tell me whether this is possible, and if so, how to do it?

I know how to post a link, but that's not what we want.

The website uses PHP, but the technique should be relatively independent of platform I think.

Thanks!
LVL 35
Terry WoodsIT GuruAsked:
Who is Participating?
 
Andrew DerseConnect With a Mentor IT ManagerCommented:
I wonder if this will help you better.  It's directly from facebook.com.  I created mine connection about 3 years ago, but left the company that needed it so I no longer know if it's working.  That link I previously sent you was similar to how we used to do it.  

https://developers.facebook.com/docs/php/gettingstarted/4.0.0

Here's the information for using PHP...
0
 
Jason C. LevineNo oneCommented:
Terry,

Like a button or a form that posts a specific message to the FB page?
0
 
Andrew DerseConnect With a Mentor IT ManagerCommented:
Take a look at this.  PHP driven and works.

http://www.pontikis.net/blog/auto_post_on_facebook_with_php
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Terry WoodsIT GuruAuthor Commented:
Yes, Jason. There will some content created by a trusted that we want to post to facebook.

NUKIT, I'll have a look at the link... thanks.
0
 
Andrew DerseIT ManagerCommented:
It may seem like a lot of work, it is, but it's a sure fire way of getting what you want.  Good luck.
0
 
Terry WoodsIT GuruAuthor Commented:
It's worth noting I found this with a google search too, though since it's over two years old there's a chance it's stopped working I suppose. I've yet to go through my options in detail...
0
 
Terry WoodsIT GuruAuthor Commented:
I wonder if this API call is what I need? It doesn't seem to mention whether it works for business pages though.
0
 
Jason C. LevineNo oneCommented:
Terry, you're on the right track.  Facebook publishes its API exactly for this purpose...you just need to create a dev key and grab one of their sample snippets and adapt it for your use.  page-id is for pages, user-id would be for people.
0
 
Terry WoodsIT GuruAuthor Commented:
NUKIT, I'm struggling to get my access token. The instructions at your link provide a method, but I haven't found a way to set the Canvas URL for my app. I don't even know what that is. Do you have any idea?

I think the procedure might be a bit dated now?
0
 
Terry WoodsIT GuruAuthor Commented:
Jason, how would I create a dev key? I don't remember reading anything about that in all the dox I've seen so far.
0
 
Jason C. LevineConnect With a Mentor No oneCommented:
Go to:

https://developers.facebook.com/apps

and create a new app to join the developer program and get a key.
0
 
Terry WoodsConnect With a Mentor IT GuruAuthor Commented:
Sorry to leave this open for so long. I did eventually get my code working, after I think about 12hrs effort!

Going by memory, the key steps were as follows:
1. Create an App from within Facebook, setting it to recognise the server where it's being tested from
2. Use the Facebook javascript API to connect to facebook/authenticate
3. Use the Facebook javascript API to authorise managing of the page of interest
4. Use the Facebook javascript API to post to it.

For development, I created buttons to do each of the above steps using the onclick attribute within the button element. I had to add lots of debugging that was output to the console to understand what was going on.

I had no luck at all getting the PHP API to authenticate, as it seems to be a requirement to authenticate with js. However it's probably possible to get the token that the Javascript API gets, and pass it on to the PHP code to make use of the PHP API from that point on.

Note also that requesting permission to "Manage" a page is required in order to post to its wall, and a special review of an app is required to be done by Facebook before you can request that permission for a public page, using an app. You don't however need that review done if you own the page yourself.
0
All Courses

From novice to tech pro — start learning today.