facebook - Posting to my FB page as the page owner/admin, not my profile name/id -
i have attempted find answer vis-a-vis fb api, google , forum.
what know type of value use 'from' field when posting /page/feed using fb api.
i began including 'picture' field , posts page happening fb account , not page does.
you must first obtain page access token before can post page. you're going need manage_pages , publish_stream permissions too. page access token, should run request using page administrator's account.
assuming you've done login , permission (scope) setting correctly, following code might give idea of how works. assuming $page_id variable holding page's id number.
<?php if ($me) { $pageaccesstoken = $facebook->api('/'.$page_id.'?fields=access_token'); if (isset($pageaccesstoken['access_token'])) { // switch use page token instead of user token $facebook->setaccesstoken($pageaccesstoken['access_token']); // setup post $params = array('message' => "this test post", 'picture' => "http://nypsit.edu.sg/images/nypsit.jpg", 'name' => "nyp sit homepage", 'link' => "http://www.nyp.edu.sg/sit/school-of-information-technology", 'description' => "nanyang polytechnic - school of information technology" ); // post page timeline $status = $facebook->api('/'.$page_id.'/feed', 'post', $params); // check if post successful if (isset($status['id'])) { echo "<h3>message posted page timeline!!!</h3>"; } } } ?>
Comments
Post a Comment