I'm using the php SDK for the Graph API, and everything is working fine-getting usernames, uploading photos etc.
However, when I'm trying to publish to the current user's feed, it just makes the page get stuck.
This is the code:
$publish_feed = $facebook->api('/'.$userid'/feed', 'post', array(
'message'=> 'message',
'picture'=> 'http://mysubdomain.mywebsite.com/photo.jpg',
'link'=> 'http://apps.facebook.com/appname/'
););
I've tried:
Putting the code in different places in the code-no matter where I do, it gets the page stuck, Even if ti is at the end of the code, it gets it stuck, and nothing shows.
changing $userid to /me. No success.
Please help.
Make sure you have the publish_stream permission
use /me or api("/$userid/feed",..etc
Remove the extra column:
Code:
$params = array(
'message' => 'message',
'picture'=> 'http://mysubdomain.mywebsite.com/photo.jpg',
'link'=> 'http://apps.facebook.com/appname/'
);
$publish_feed = $facebook->api("/$userid/feed", "post", $params);
Related
So. I can't make this work and i can't find any solution about this.
Here is my code.
$result1 = $facebook->batchApi('***********/feed', 'POST', array(
'attached_files' => $facebook->attachFile($uploads[2]),
));
$result2 = $facebook->batchApi('*********/feed', 'POST', array(
'attached_files' => $facebook->attachFile($uploads[1]),
));
$res = $facebook->processBatch(array(
"access_token" => $user_profile['data'][0]['access_token'],
));
I'm using facebook-batch-api. It's just simple wrapper for batch requests.
Need make post like this https://www.facebook.com/centrMAN/posts/587573351326832
You cannot post multiple images to a single feed. (Dosen't make any sense either)
The example link that you've mentioned in simply posting photos, not adding photos to a feed.
So, instead of /feed, simply use the /photos API to get the result.
I have recently noticed that facebook has started ignoring my og:image tag on my site. The image used is always larger than 200x200.
Here is an example page:
http://bit.ly/15CrOhS
http://bit.ly/1b8Mgbe
Seems to be alot of questions, but no answers. I've added all the og information and checked with the linter and it all goes through fine. So why does it choose to pick a random image?
I use the facebook api for PHP to send:
<?php
$link = 'http://www.mylinkaddress.com';
$msg = 'Check out my new photo. '.$link;
$get_oauth = "SELECT * FROM users_oauth_cred WHERE userid = ".$_SESSION['userid']." AND share = 1 AND oauth_access_token != ''";
$get_oauth = mysql_query_run($get_oauth);
$oauth = mysql_fetch_array($get_oauth);
# FACEBOOK
$facebook = new Facebook(array(
'appId' => FACEBOOKAPPID,
'secret' => FACEBOOKSECRET,
'cookie' => false,
));
$token = $oauth['oauth_access_token'];
try {
$result = $facebook->api(
'/me/feed/',
'post',
array('access_token' => $token, 'message' => str_replace($link,'',$msg), 'link' => $link)
);
}
catch(FacebookApiException $e) {}
?>
I had the same issue.
Go to Facebook Object Debugger, verify every issue pointed there, fix them all. This solved my problem.
http://goo.gl/ASBsAa
Testing your query with the facebook Graph API Explorer worked fine for me.
You could try to add the additional parameter 'picture' to your post and place the link to your image in it.
So facebook is forced to use this as image in the post.
$result = $facebook->api(
'/me/feed/',
'post',
array('access_token' => $token, 'message' => str_replace($link,'',$msg), 'link' => $link, 'picture' => 'http://images.ephotozine.com/gallery/2011/49/normal/52194_1323334048.jpg')
);
Reading through all the comments here, I think what's happened is the following.
Let me know how close I got. This is a shot in the dark. ;)
The first time you shared a URL to Facebook, the og:image wasn't set up perfectly, and Facebook selected a random image on the page, and cached it.
You then fixed the og:image tag, and tried to check the same URL.. FB then regurgitated the cached image.
I tried with both your links just now, and everything seems fine.
:{D
Just be patient. Facebook needs some time to crawl this image. It will not immediately show up in Facebook. If your image is not showing up in some days, just drop a note here.
Much testing and trying other bulk uploaders etc. Finally just decided to email facebook with details and screnshot. next day the issue has been resolved. So, make sure to try that from the help email through your facebook account. worked for me.
I'm using below code to post to my facebook page as page
$post_id = $facebook->api("/$page_id/feed","post",$args);
I want to make a comment to the post I created. I don't know how to do that exactly. But based on some research, I tried below code and it didn't work.
$comment_id = $facebook->api("/$post_id/comments?message='This is m message'");
An echo or print_r for $comment_id doesn't return anything.
How can I accomplish it i.e. posting comment to a post on my Facebook page using Facebook graph API for PHP? Kindly guide me in the right direction.
Try something like this,
$facebook ->api('/'.$post_id.'/comments',
'post',
array(
'access_token' => $your_access_token_variable,
'message' => 'Your message',
)
);
I use following code to update the status:
$parameters = array(
'message' => "Hey guys check this cool app",
'link' => "http://apps.facebook.com/xxxx",
'name' => "Invitation for xxxx",
'picture'=>"http://localhost:55/xxxx/logo.jpg",
'caption' => "Try xxxx!",
'access_token'=>$at //valid access token
);
try{
$statusUpdate = $facebook->api('/me/feed', 'POST', $parameters);
}catch(FacebookApiException $e){}
This works and after status update, I get an id. But when i go to my profile and check the status update, This is what I see:
. The problems are: (1) Image is not displayed, and (2) Unwanted My first app as shown in figure. Why is this happening? How do i fix it?
http://localhost/... is never going to work as the image location because Facebook won't be able to retrieve it. Put the publicly accessible URL to the image in that field instead.
In the screenshot you posted, the 'My first app' part is the name of the app, you can change this in the app settings. It can't be changed on a per-post basis, all posts from your app are attributed to your app
As far as the image is concerned, check again that the path of the image is correct. If it still does not work, try specifying 'https' instead of http and see what happens
I have an app which uses the Facebook PHP SDK. It used to be a simple matter to post to a user's Facebook wall. I would do the authentication, and then something like:
$ret_obj = $Facebook->api('/me/feed', 'POST',
array(
'link' => 'www.example.com',
'message' => 'Posting with the PHP SDK!'
));
and on their wall the link would appear. Since Timeline was introduced, however, this doesn't seem to work. I don't get an error, I just don't get anything back. I can't find any helpful documentation on how this should work.
More info
I don't get any error, I just get "NULL" returned in $ret_obj.
If I do something like
$ret_obj = $Facebook->api('/me', 'GET');
then it works fine - I get the user's information back. So it's connecting ok, just not posting.
Double check that you have allowed publish_stream permission.
You can refer to PHP SDK and JavaScript SDK Feed Dialog for more examples.
Official Documentation: http://developers.facebook.com/docs/reference/dialogs/feed/