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.
Related
I am using php script for liking a post externally through open graph and facebook API
$response = $facebook->api('/me/og.likes','POST',array('object' => ""));
in my above code what i have to write in object so that my post will be liked .
Thanks
Put the URL of the object in the double quotes like so:
$response = $facebook->api( '/me/og.likes', 'POST', array( 'object' => "http://www.example.com/foo" ) );
But for this to work you must make sure that the document you are linking to has opengraph metadata. Check the docs.
I haven't find anything related. Might be i would have searched wrongly.
I want to tag friends in video.
How do i do that using graph api in facebook?
It is possible to tag friends in a video, but it's just not in the documentation. I've searched quite some time myself to no avail, but then tried a couple of things and got it working.
The two permissions you need are publish_actions and user_videos.
It works quite similar to tagging photos, which is done with the /{photo_id}/tags endpoint. Although the video equivalent /{video_id}/tags is nowhere to be found in the documenation, it apparently does exist.
With photos you can supply the parameter tags as an array. Video tagging only supports one tag at a time with the tag_uid parameter. So if you want to tag multiple people, you'll have to do multiple posts.
This is the final working solution with the PHP SDK:
$facebook = new Facebook(array('[YOUR_APP_ID]', '[YOUR_APP_SECRET]'));
$response = $facebook->api('/me/videos', 'POST', array(
'access_token' => $facebook->getAccessToken(),
'title' => '[YOUR_TITLE]',
'description' => '[YOUR_DESCRIPTION]',
'source' => '#' . realpath('[PATH_TO_YOUR_VIDEO')
));
$facebook->api('/' . $response['id'] . '/tags', 'POST', array(
'access_token' => $facebook->getAccessToken(),
'tag_uid' => '[FRIENDS_FACEBOOK_ID]'
));
Read this
https://developers.facebook.com/docs/reference/api/post/
The post supports adding message tags.
Under the message_tags column
object containing fields whose names are the indexes to where objects are mentioned in the message field; each field in turn is an array containing an object with id, name, offset, and length fields, where length is the length, within the message field, of the object mentioned
(noob question)
Using the example.php that comes with the PHP SDK I can post to my timeline successfully.
I'd like though to be able to set the date, so I added:
:
:
'created_time' => "2012-06-21T13:46:10+0000",
'updated_time' => "2012-02-19T14:46:10+0000",
'actions' => array(
array(
'name' => 'Get Search',
'link' => 'http://www.google.com'
)
)
);
$result = $facebook->api('/me/feed/', 'post', $attachment);
?>
<?php endif ?>
But created_time is ignored, the post is always "NOW". I've searched around for a solution to this but found nothing. Am i doing something wrong, is it a typo, or just not possible like this?
Looking on the web I did find articles about placing "ACTIONS" in the past - e.g.: How can I add a custom date to the facebook timeline through graph api
Is that the (only?) way to go, create a "publish" action ,,. with start_time etc.? Any links to how to do this (in PHP?)
You can only create actions in the past, not Posts using the API. However, you can manually change the date of a post using the Activity Log - it doesn't look like this feature is available via the API yet.
First, what I have:
I have an FB app which is able to get a user's access_token and post on user's wall using FB API in PHP.
Can anyone please help me to 1) post on my all groups wall using a batch request (or any other technique) and 2) how to get my all groups id?
If I use my app to post on my all groups (100+) wall, is it ok with FB?
Does FB treat this as spam ?
Thanks
i have created a facebook application 1 month back, called WooTube
To promote my application free,i joined around of 100 Groups to promote my fb video app in various of interest base like "KPOP,SNSD,SUPER JUNIOR,Just For Laught and etc" with my application build in features "Post To My Group".It is writen using fb.api
https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-ash4/383568_191076937694203_922285357_n.jpg
Unfortunately this is spam...i was blocked from facebook for 2 days due to spamming.The reason is i shared the same link for around 30-40 time in less then 5-10 minutes.
what i would like to suggest is:
Do not share the same link for more then 20 times per day (to be safe)
Do not post too frequence, each post should have a space of 10 second.
Don't used your own account for spamming (you know what i talking about :) )
You can use Facebook batch API to post to multiple wall (groups, pages or friends wall).
The basic method to do it is shown below. The IDs can be User IDs, group IDs or Page IDs.
You can read more about it at: http://25labs.com/tutorial-post-to-multiple-facebook-wall-or-timeline-in-one-go-using-graph-api-batch-request/
$batchPost[] = array(
'method' => 'POST',
'relative_url' => "/{ID1}/feed",
'body' => http_build_query($body) );
$batchPost[] = array(
'method' => 'POST',
'relative_url' => "/{ID2}/feed",
'body' => http_build_query($body) );
$batchPost[] = array(
'method' => 'POST',
'relative_url' => "/{ID3}/feed",
'body' => http_build_query($body) );
$multiPostResponse = $facebook->api('?batch='.urlencode(json_encode($batchPost)), 'POST');
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);