javascript - Facebook API auto post on wall -
javascript - Facebook API auto post on wall -
i have requirement need publish updates on users wall automatically. users have granted permission publish_actions , have user ids stored in db. using cron jobs, want update users wall either photos or links.
i tried code:
<?php $config = array(); $config['appid'] = 'xxx'; $config['secret'] = 'xxx'; $config['fileupload'] = false; // optional $facebook = new facebook($config); $session = $facebook->getuser(); $result = $facebook->api(array( 'method' => 'users.setstatus', 'status' => 'hello world', 'uid' => '123', /// user_id 'session' => $session, )); ?> this works fine, not sharing links feed or photos. using js sdk possible seems fb has discontinued since 6 feb 2013.
is there right way this?
use facebook 3.0 php-sdk, $facebook->api() first argument requires endpoint /me/feed, /me/photos while sec method get, post , delete , 3rd array of parameters want send along phone call try:
$session = $facebook->getuser(); if ($session) { $p = array( 'message' => 'hello world', 'access_token' => 'caaa...' ); // valid access token publish_action permission $result = $facebook->api('/me/feed', 'post', $p); } else { $loginurl = $facebook->getloginurl(); header('location:'. $loginurl); } javascript php facebook sdk
Comments
Post a Comment