Posting to facebook event wall
Posted: Fri Oct 22, 2010 4:05 pm
Hey Everybody,
I've been working on a script to post to various social networks. I'm a fairly strong programmer, but have never worked with OAuth or the Facebook graph api. So as the title says, i'm trying to write a script that will make a post onto a facebook event wall.
Here is the code i have so far
and this is to post to my feed... just as a test. As of right now, it says i don't have permissions. One thing to note is that this script will be executed by a cronjob, so i need to enable access for as long as possible and used the following url to get the access token. (you will notice in my scope i have offline_access and publish_stream).
https://graph.facebook.com/oauth/author ... client_id=[my id]&redirect_uri=[my uri]&scope=offline_access,publish_stream
So that is all good, i accept the permissions and it redirects back to my script with the access token in the url. And now i'm stuck. What do i do with the access token? How do i finish the authentication process?
Thank you in advance for any replies, i will be checking this all day to get as fast as a resolution as possible. If you need any info just ask!
I've been working on a script to post to various social networks. I'm a fairly strong programmer, but have never worked with OAuth or the Facebook graph api. So as the title says, i'm trying to write a script that will make a post onto a facebook event wall.
Here is the code i have so far
Code: Select all
require 'facebook-php-sdk/src/facebook.php';
$fb = new Facebook(array(
'appId' => '100164043386901',
'secret' => '74068d49e68012612e2440eea74f0301',
'cookie' => true,
));
$fb->api('/me/feed', 'POST', array(
'message' => 'This is a test post',
'picture' => '',
'link' => '',
'name' => '',
'caption' => '',
'description' => '',
'icon' => ''
));
https://graph.facebook.com/oauth/author ... client_id=[my id]&redirect_uri=[my uri]&scope=offline_access,publish_stream
So that is all good, i accept the permissions and it redirects back to my script with the access token in the url. And now i'm stuck. What do i do with the access token? How do i finish the authentication process?
Thank you in advance for any replies, i will be checking this all day to get as fast as a resolution as possible. If you need any info just ask!