views:

144

answers:

2

Hello,

I've setup a script which allows users to post messages to a fan page on Facebook. It all works but there's one small issue.

The Problem:

When the post is added to the page feed it displays the posting user's personal account. I would prefer it to show the account of the page (like when you're admin of the page it says it came from that page). The account I'm posting with have admin rights to the page, but it still shows as a personal post.

HTTP POST

$url = "https://graph.facebook.com/PAGE_ID/feed";
$fields = array (
    'message' => urlencode('Hello World'),
    'access_token' => urlencode($access_token)
);

$fields_string = "";
foreach ($fields as $key => $value):
    $fields_string .= $key . '=' . $value . '&';
endforeach;
rtrim($fields_string, '&');

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);

$result = curl_exec($ch);
curl_close($ch);

Thanks.

A: 

As far as I know, all you have to do is specify a uid (that is, the page's ID) in your call to stream.publish

EDIT

Have a look at impersonation

Peter Bailey
When using the Graph API I can only set the following parameters: message, picture, link, name, caption, description, source. There doesn't appear to be an option for the ID of sender. http://developers.facebook.com/docs/reference/api/post
diggersworld
I think it gets user ID from the access_token. But because I am admin of the page I would expect Facebook to recognise that. Doesn't seem to though.
diggersworld
You "think"? You "expect"? Did you even try specifying the page's ID as the uid to see what happens? Also, I added another link for you to check out.
Peter Bailey
I did try specifying the pages ID as the UID and nothing happened. Anyway... it appears from your link that I was missing the manage_pages permission, so I'm going to try that now.
diggersworld
Okay... I have allowed permissions for manage_pages and can now see my pages in the accounts. However it still posts as if I'm commenting from my personal profile rather than as an admin, added my code above.
diggersworld
I got it now, thanks.
diggersworld
A: 

Here this process is described in details.

serg
I got it now, thanks.
diggersworld