I am able to post from my CMS and share the post directly on the fan page wall.
BUT only when I have signed in to facebook, and have copied the access token from my admin profile, and directy inserted it into the php script that sends the post from the cms to Facebook fan page wall.
So its pretty much useless, as I cant share the post when :
- Im logged out of facebook
- The access token has changed (because I had logged out...)
And I am eager to know how I can set the access token to be long lived or never to expire, so that I dont need to go into developeres facebook, graph stuff, and THEN copy the access token and insert into the script in the cms..Not very dynamic..
This below works, when I have copied the access token from the developers site - but how do I get that access token, which changes every time I have logged out.
// Facebook post details : $access_token = 'LONG NUMBER...'; $page_id = 'MY_FAN_PAGE_ID'; $status_msg = 'Message to be posted.... :-)'; //$picture = 'http://www.mysite.com/img/pic.jpg'; //$link = 'http://www.mysite.com.dk/'; //$caption = 'Read the latest news..'; $params = array('access_token'=>$access_token, 'message'=>$status_msg); $url = 'https://graph.facebook.com/MY_FAN_PAGE_ID/feed'; // Curl : $ch = curl_init(); curl_setopt_array($ch, array( CURLOPT_URL => $url, CURLOPT_POSTFIELDS => $params, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_VERBOSE => true )); $result = curl_exec($ch); echo '<p style="color:#FFF;">'.$result.'</p>'; // End
I dont currently have an APP, so I am not grapping information from whatever permissions an app could have, related to a fan Page.
Can I get an access token, even if the administration user of the fan page is logged out?? - AND, I need to post to the fan page as the page itself, not as the administrative user of the page
Best regards, Klemme