Reputation: 3515
i am using the fb graph api to post on fb.
here is my code..
include_once("config.php");
$page_id = '2267dsfgsfdsg32';
$facebook->setFileUploadSupport(true);
$args = array('message' => 'Photo Caption');
$args = array(
'access_token'=>"CAADHIv47plHx i changed it nCCGDqEWNQZBZBySZC04xXDyqn0jZB3",
'message' => 'This photo was uploaded ',
'name' => 'Product name',
'caption' => 'Accomplished!',
'link' => 'http://www.adspace.lk/',
'picture' => 'http://adspace.lk/assets/img/tmp/banner2.jpg');
$data = $facebook->api('post', $args);
print_r($data);
i get the error
Fatal error: Uncaught OAuthException: (#803) Some of the aliases you requested do not exist: post thrown in /home/design/public_html/jksb/fb/inc/base_facebook.php on line 1249
can any one help me to fix this error plz...
Upvotes: 2
Views: 12440
Reputation: 631
This error occurs when you either miss to specify all the required fields or your addressing is wrong. So, first off, as I see, you miss an App name on whose behalf you would be sharing the activity on user's activity feed. So, you may first create an App here. Then, you need to define actions and objects which you would be sharing in the feed. Collectively, you may need to create Custom Stories (if you intend to create custom stories, on the same link I shared; just go to 'Open Graph' option). For predefined stories by facebook, such as video, your post action would be like following. Also, You need to specify the type of object you're sharing, like this:
$facebook->api($user_id.'/app_name:activity_name','POST',$post_obj);
where $post_obj
is $post_obj = array('other'=>$args)
other
is index for 'video' objects. You may check/change that to the object name you're sharing. This could be 'blog', 'news' or whatever you may create.
Upvotes: 0
Reputation: 31489
You're using no endpoint, post
is the HTTP method of the request. Try using /me/photos
as noted on https://developers.facebook.com/docs/graph-api/reference/v2.0/user/photos/#publish
There's also an example here: https://developers.facebook.com/docs/php/howto/uploadphoto/4.0.0
Upvotes: 2