Reputation: 1055
I am trying to publish post on facebook via my website.
I have these permissions
'scope' => 'read_stream, email, publish_stream, user_birthday, user_location, user_work_history, user_hometown, user_photos',
But I am unable to publish a post. Example is below which i cant publish.
if(isset($_POST['publish'])){
try{
$statusUpdate = $facebook->api("/$user/feed", 'post', array(
'message' => 'Message here',
'link' => 'webiste link here',
'picture' => 'image link here',
'name' => 'Heading',
'caption' => 'example.com',
'description' => 'bla bla bla bla',
));
}catch(FacebookApiException $e){
error_log($e);
}
}
But I am successfully able to post simple posts(status) with just message
if(isset($_POST['status'])){
try{
$statusUpdate = $facebook->api("/$user/feed", 'post', array('message'=> $_POST['status']));
}catch(FacebookApiException $e){
error_log($e);
}
}
Can any one tell me what additional permission I need or what I am missing?
with Graph API I get this error
{
"error": {
"message": "(#100) The post's links must direct to the application's connect or canvas URL.",
"type": "OAuthException",
"code": 100
}
}
In my error_log.php
i found this
OAuthException: (#100) The post's links must direct to the application's connect or canvas URL.
Upvotes: 1
Views: 270
Reputation: 54258
To tackle the error: (#100) The post's links must direct to the application's connect or canvas URL.
, you have to set "Stream Post Url Security" to false in App Setting.
Sidenote: You don't need user_birthday
and others to publish a feed. Only publish_stream
is required.
Upvotes: 1