I'll try my best not to make this too long winded. Basically, with Open Graph, if a user 'likes' a web page (in my example, a blog), you can set it up so that when a new post is added, an entry is shown in their news feed linking to it.
For how this is allegedly done, see here: https://developers.facebook.com/blog/post/465/
Basically, you add OG meta tags to your site, create an app, link to the app_id in the OG tags, like the page and it will then create a kind of invisable facebook page that only the admins can see - users get taken to the site instead. The crutial thing is, because people 'like' this page, you can write posts from that page and the users will see it.
The weird thing is, this worked for me yesterday but it's suddenly stopped working. Nothing's changed, it just stopped working.
So I've created a blog, added the correct meta OG tags, created an app, added the fb:app_id tag to the blog containing the app ID.
The code in the example can be split into two parts. Firstly, getting the access token:
$access_token_url = "https://graph.facebook.com/oauth/access_token";
$parameters = "grant_type=client_credentials&client_id=" . $app_id . "&client_secret=" . $app_secret;
$access_token = file_get_contents($access_token_url . "?" . $parameters);
That works fine, it returns an access token. However, the second part of the example, posting from the facebook page doesn't work.
$apprequest_url = "https://graph.facebook.com/feed";
$parameters = "?" . $access_token . "&message=" . $mymessage . "&id=" . urlencode($ogurl) . "&method=post";
$myurl = $apprequest_url . $parameters;
$result = file_get_contents($myurl);
The error I get is: (#200) The user hasn't authorized the application to perform this action
Has Facebook changed their API in the last 24 hours or something?
Any help would be much appreciated as this is driving me completely nuts!
Cheers Pete