Solved

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

Posted on 2015-01-29
12
178 Views
Last Modified: 2015-05-06
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
Comment
Question by:Terry Woods
  • 6
  • 3
  • 3
12 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40578978
Terry,

Like a button or a form that posts a specific message to the FB page?
0
 
LVL 13

Assisted Solution

by:Andrew Derse
Andrew Derse earned 333 total points
ID: 40578989
Take a look at this.  PHP driven and works.

http://www.pontikis.net/blog/auto_post_on_facebook_with_php
0
 
LVL 35

Author Comment

by:Terry Woods
ID: 40579070
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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 13

Expert Comment

by:Andrew Derse
ID: 40579082
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
 
LVL 35

Author Comment

by:Terry Woods
ID: 40579127
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
 
LVL 35

Author Comment

by:Terry Woods
ID: 40579147
I wonder if this API call is what I need? It doesn't seem to mention whether it works for business pages though.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40579174
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
 
LVL 35

Author Comment

by:Terry Woods
ID: 40579224
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
 
LVL 13

Accepted Solution

by:
Andrew Derse earned 333 total points
ID: 40579892
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
 
LVL 35

Author Comment

by:Terry Woods
ID: 40611207
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
 
LVL 70

Assisted Solution

by:Jason C. Levine
Jason C. Levine earned 167 total points
ID: 40615884
Go to:

https://developers.facebook.com/apps

and create a new app to join the developer program and get a key.
0
 
LVL 35

Assisted Solution

by:Terry Woods
Terry Woods earned 0 total points
ID: 40763800
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

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out how to use dynamic social media in email signatures with this top 10 DOs & DON’Ts.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question