1

Im using the Facebook SDK Api [PHP] to post automaticly on a timeline wall.

I created a App and requested the access_token with the following permissions: manage_pages,publish_stream,offline_access.

Im using now the access_token to post the message on a page (/PAGEID/feed) where im moderator.

The following is going OKAY and get the post working under the name of the Facebook page:

$attachment = array(
    'access_token'      => $accessToken,
    'message'           => $description,
);

$res = $facebook->api('/PAGEID/feed', 'POST', $attachment);

When Im adding some link + name AND/OR picture it will post not as wall post but as "recent message of others" with as name my own user:

$attachment = array(
    'access_token'      => $accessToken,
    'message'           => $description,
    'link'              => 'http://www.google.nl',
    'name'              => $description,
    'picture'           => $image,
);

How can I post full messages with link and picture on the wall self?

ShawnDaGeek
  • 4,145
  • 1
  • 22
  • 39
Arek van Schaijk
  • 1,432
  • 11
  • 34

2 Answers2

2

If I understand you correctly, you are trying to post as the Page but it's showing up as a post by you. Is that correct?

If so, I think you need to post using the Page's access token, rather than your own access token. Look at the section called "Page Access Tokens" on https://developers.facebook.com/docs/reference/api/page/. Once you get the page's access token using the technique described there, you can set it to be the token that PHP SDK uses by doing $facebook->setAccessToken(.... access token value ...). Then you can do the post and it should show up as having been created by the page.

triangle_man
  • 1,072
  • 6
  • 10
-3

This problem troubled me for so long. Everything seemed setup correctly but as soon as I added a link, it would post as Admin instead of Page. The answer above by triangle_man solved my problem. When using the PHP sdk, the specific line of code I needed was:

$page_token = $facebook->api("/$page_id?fields=access_token");

Andrew
  • 1
  • This draws attention to the line of code needed but it really doesn't answer the question. Instead you reference the accepted answer. – Lipongo Oct 26 '12 at 21:30