• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 207
  • Last Modified:

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!
0
Terry Woods
Asked:
Terry Woods
  • 6
  • 3
  • 3
4 Solutions
 
Jason C. LevineNo oneCommented:
Terry,

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

http://www.pontikis.net/blog/auto_post_on_facebook_with_php
0
 
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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
 
Andrew DerseIT 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
 
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. LevineNo oneCommented:
Go to:

https://developers.facebook.com/apps

and create a new app to join the developer program and get a key.
0
 
Terry WoodsIT 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 6
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now