Yes there's almost a hundred same question as this. i have tried the answers provided and searched on forums etc...but all didn't work for me :( . I a have an app on facebook. I want to post a link to my page's timeline. (NOT ON USER'S TIMELINE). how can i do this using php sdk? i found this post How do you post to the wall on a facebook page (not profile). it's very informative yet i still dont know excatly what to do. i also rea this post Post to Facebook Page Wall. still no help for me. this is what i have at the moment:
require_once('libs/facebook.php');
$facebook = new Facebook(array(
'appId' => 'xxxxxxxxxxxxxxxxxx',
'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx'
));
$attachment = array(
'link' => $post_link,
'message' => 'Another Super Story!',
'actions' => array(
array(
'link' => $post_link
)
)
);
$result = $facebook->api('/me/feed/', 'post', $attachment);
i saw this code but i dont know what the number stands for
$facebook->api('/123456789/feed', 'post', array(
'access_token' => $token,
'link' => 'http://www.example.com'
));
please help me. im desperate to solve my problem. i dont know what to do. thank you in advance.
EDIT: i now have this code as i have refered to this question Facebook API: How to post to my own wall page? . but still, not working for me. anyone who could tell what i'm missing?
$page_access_token = "2xxxxxxxxxxxx|bxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$result = $facebook->api("/me/accounts");
foreach($result["data"] as $page) {
if($page["id"] == $page_id) {
//$page_access_token = $page["access_token"];
$page_access_token = $facebook->api("/".FB_PAGE_ID."?fields=access_token");
break;
}
}
$attachment = array(
'message' => $post_msg,
'link' => $post_link,
'access_token' => $page_access_token,
);
$facebook->api("/".FB_PAGE_ID.'/feed', 'POST', $attachment);