I am using the below array and
$feeddata = array(
'type'=>'flash',
'method'=>'stream.publish',
'display'=>'iframe',
'link'=> 'https://developers.facebook.com/docs/reference/dialogs/',
'source'=>'http://www.hackerdude.com/channels-test/swfscout_VideoSample.swf',
'picture'=> 'http://fbrell.com/f8.jpg',
'name'=> 'Facebook Dialogs',
'caption'=> 'Reference Documentation',
'description'=> 'Using Dialogs to interact with users.');
and passing it to facebook->api($userid.'/feed', 'POST', $feeddata );
But in the feed i can see only the image and when i click in the image it takes me to the link, how can i see swf in the feed (ideally on clicking on the picture it should toggle to swf)
The type should be "video" instead of "flash". Here's a parameter array that produced a playable video in my tests:
array(
'type'=>'video',
'source'=>'http://www.hackerdude.com/channels-test/swfscout_VideoSample.swf',
'picture'=> 'http://fbrell.com/f8.jpg',
'name'=> 'Facebook Dialogs',
'caption'=> 'Reference Documentation',
'description'=> 'Using Dialogs to interact with users.',
);
Note that there's no link attribute, that's because as it seems to me, the facebook API has a bug at this moment where if you provide a link then it won't embed your video.
The bug theory reinforced by that the JS SDK does indeed accept a link and produce a playable video, you could migrate to this method for publishing if its feasable, with parameters like this:
FB.ui({
method:'feed',
type: 'video',
name: 'Facebook Dialogs',
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
caption: 'Reference Documentation',
source: 'http://www.hackerdude.com/channels-test/swfscout_VideoSample.swf',
description: 'Using Dialogs to interact with users.'
});
Workaround
The embedding seem to be working fine if you post a link that has the proper opengraph meta tags for video embedding, here's an example:
the link to be shared (video brought to you by youtube)
<html>
<head>
<title>Fly, you fools!</title>
<meta property="og:title" content="Fly, you fools!" />
<meta property="og:type" content="website"/>
<meta property="og:description" content="Content for Description" />
<meta property="og:image" content="http://i2.ytimg.com/vi/meOCdyS7ORE/mqdefault.jpg" />
<meta property="og:site_name" content="Content for caption"/>
<meta property="og:video" content="http://www.youtube.com/v/meOCdyS7ORE?version=3&autohide=1">
<meta property="og:video:type" content="application/x-shockwave-flash">
<meta property="og:video:width" content="640">
<meta property="og:video:height" content="360">
</head>
<body>
<script>
window.location = 'http://disney.com'; // redirecting users who's clicking on the link, wont affect crawlers since its in js.
</script>
</body>
</html>
php sdk call to share it
$this->facebook->api('/me/feed', 'post', array(
'type' => 'link',
'link' => 'http://.../', // put the html file's location here
));
write one more met tag :
<meta property="og:video:secure_url" content="https://...game url.">
"
try to put "https:// " game url ,i.e game swf url with ssl, because fb takes only ssl url to play videos or swf file for game.
Hope this will be useful.
Related
I'm struggling to post a facebook page/feed with a image.
I'm following all the documentation but, damm :(, it's not working
https://developers.facebook.com/docs/graph-api/reference/v2.10/page/feed#publish
using the object_attachment to pass and upload photo id.
I've tried with an already uploaded image and a new upload but
Nothing appears to work
If i run this, all works as expected but the image does not work
$args = array( 'access_token' => $pag_access_token,
'message' => $description,
'object_attachment' => $photoID,
'link' => $link);
$status = $facebook->api("/$facebookUsername/feed", 'post', $args);
Note: $photoID is a valid facebook photo.
Result:
Any thoughts??
Update: SOLUTION
Thanks to #Norbert insights heres how we can accomplish that:
Using the Graph api we need to pass the access_token, the link (important) and a description (optional)
On the api endpoint, i was just sharing the message and the link to my frontend page.
$args = array( 'access_token' => $pag_access_token,
'message' => "option text",
'link' => $options['link']);
$status = $facebook->api("/$facebookpage/feed", 'post', $args);
With the above code you will be able to share to facebook feed your message, but without the title of your post and the image.
To do that you will need to add the following metadata into your destination page ($link that was shared)
2.
<meta property="og:url" content="YOUR URL">
<meta property="og:type" content="website">
<meta property="og:title" content="URL TITLE">
<meta property="og:description" content="SMALL DESCRIPTION">
<meta property="og:image" content="http://IMAGE SERVED WITH HTTP">
<meta property="og:image:secure_url" content="https://IMAGE SERVED AS HTTPD">
if the url you want to share is served over https you must also include the og:image:secure_url
They need to be served under the same protocol.
Hope this help everyone with the same problem.
Regards
I am using FB.ui() to share a page and on mobile the og image is cropped to a square, instead of being desiplayed entirely.
The natural size of my og image 1200x622. How can I specify its dimensions using FB.ui method?
Here is the code I am using:
FB.ui({
method: 'share',
action_type: 'og.shares',
href: 'http://example.com/',
title: 'My title',
picture: 'http://example.com/picture.jpg',
description: 'My description'
}, function(response){
console.log(response);
});
Thank you,
Andru
You can´t change the share image in the Share Dialog, you need to use the Feed Dialog for that: https://developers.facebook.com/docs/sharing/reference/feed-dialog/
If you want to use the Share Dialog, make sure you follow the guidelines to get the best picture after sharing: https://developers.facebook.com/docs/sharing/best-practices#images
Also, you should include the size directly in your HTML code:
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
Source: http://ogp.me/
If all those things don´t work for you, you can file a bug: https://developers.facebook.com/bugs/
I am using facebook send method for invite friends in my website.
this is the code
function FacebookInviteFriends()
{
FB.ui({
method: 'send',
name: 'Join Stuffuneed',
picture: '<?php echo $this->getSkinUrl('images/owl_logo_250_250.jpg') ?>',
link: '<?php echo $customerLink?>',
description: "You have been invited to join Stuffuneed. Stuffuneed is the place to find the stuff you always needed but didn't know where to find",
});
}
it's showing me this dialog
problem is this
it's not showing me exact name.picture,link description.
i have also use og meta tags
<meta property="og:title" content="Join Stuffuneed" />
<meta property="og:image" content="http://www.stuffuneed.com/stuffuneed/skin/frontend/default/lockrez/images/owl_logo_25_250.jpg"/>
<meta property="og:site_name" content="Stuffuneed"/>
<meta property="og:url" content="http://www.stuffuneed.com/stuffuneed/"/>
<meta property="og:type" content="website"/>
but it's still showing me wrong content
Pls help me...
description picture are not the valid parameters in the send dialog. Reference
You'll just have to provide the link; and fb will fetch the image by itself. May be you can set the meta tag of og:image in the link you have provided.
I have facebook feed dialogues successfully setup up for my application using the Facebook UI method, but I'm getting some odd behavior when another user tries to use the "Share" link on Facebook. The content for this re-share is not the same content initially shared and appears to be a snippet of javascript.
This is my current feed dialogue code:
FB.ui({
method: 'feed',
redirect_uri: link.attr('href'),
name: "Check out this image on WorkHands",
picture: link.closest('.thumbnail').find('.featured-image').attr('src'),
link: link.attr('href'),
caption: 'Work by' + link.closest('.thumbnail').find('.project-creator').text(),
description: link.closest('.thumbnail').data('description'),
display: 'popup'
}
Which yields something like this:
However, as soon as it's shared on Facebook, the dialog looks like this:
I can only think that this must have something to do with the metatags on the page?
Currently the meta-tags are a little different than the ones being created for the feed dialog:
<meta content="103896" property="fb:admins" />
<meta content="WorkHands" property="og:site_name" />
<meta content="website" property="og:type" />
<meta content="Project by Ron Andrade" property="og:title" />
<meta content="https://www.workhands.us/images/78a98834-59fa-48c7-8d93-8ffaa0a75811" property="og:url" />
<meta content="https://www.workhands.us/assets/work-hands-logo-595.png" property="og:image" />
<meta content="WorkHands is for workers in construction, plumbing, welding, landscaping, electrical, masonry, HVAC, automotive, trucking, and other skilled trades." property="og:description" />
I have a problem when posting video through my app on users with TimeLine profile.
the post appears very small and when clicked the video opens on a new tab instead of playing inside facebook.
Here are some details :
I'm building an application that create customized videos (SWF) and post them on a user's friend wall.
I'm "wrapping" the SWF file in an HTML file that include the following "meta og:" tags -
<meta property="fb:app_id" content="******" />
<meta property="og:url" content="THIS PAGE URL" />
<meta property="og:title" content="Title" />
<meta property="og:description" content="some description" />
<meta property="og:type" content="video" />
<meta property="og:image" content="an img url" />
<meta property="og:video" content="URL TO THE SWF FILE" />
<meta property="og:video:type" content="application/x-shockwave-flash" />
<meta property="og:video:width" content="396" />
<meta property="og:video:height" content="297" />
<meta property="og:site_name" content="pickle-games" />
and then in the body i embed the SWF using the "embed" tag.
You can see an example by viewing the source of http://pickle-games.com/BigBully/hitVideo.php?hit_id=1327242593&hit=hit2
I'm using the facebook PHP SDK to post on the wall like this :
$facebook->api("/" . $uid . "/feed", "POST",
array(
'link' => $server_url . 'hitVideo.php?hit='. $hit . "&hit_id=".$hit_id ."&u_name=" . $u_name . "&f_name=". $f_name
));
When posting on a user with the old profile (not the timeline) everything works fine and the video plays inline, on the wall.
The problem, as mentioned above, is only when posting on a user that uses the TimeLine profile
BTW - if i share the link manually (not through my app) on the friend's timeline then everything works fine...
What am i missing?
How do i post it through my app in a way that it will work also on the timeline?
Thanks.
Try this
$attachment = array(
'message' => 'SOMETHING HERE!',
'name' => 'name!',
'caption' => 'caption!',
'link' => 'http://link.com',
'description' => 'description here!',
'access_token' => $request["oauth_token"],
'picture' => 'http://link.com/image.jpg',
'source' => 'link.com/flash.swf',
'actions' => array(array('name' => 'some action',
'link' => 'https://link.com/'))
);
$result = $facebook->api('/'.$friend_id.'/feed/','post',$attachment);
It is very important to put something in the 'message' or else is going to give you that same error...
Just a note, if you do not have
<meta property="fb:app_id" content="xxxxxxxxxxxxxxxx" />
When posted to the wall, the video will open in a NEW window.