Upload video to facebook with php api v2.5 - php

I am trying to allow user to share video on my website to their facebook.
$data = [
'title' => urldecode($_GET['c']),
'description' => urldecode($_GET['t']),
'source' => $fb->videoToUpload('video/video_1mb.mp4'),
];
$response = $fb->post('/me/videos', $data, $accessToken);
Above is the php code I used to post the video to their facebook. It works but I have some questions:
I have some description and links (in the description) wants to share with the video to facebook. As facebook is not allowed to prefill sharing message in the post, how can I add description and links? I want the description and links show below the video. Just like sharing a youtube video to facebook. When you play the youtube video on facebook, there is some text below the video. Can I do the same things for facebook video?
I know you can add a link at the end of the facebook video on facebook page. Can I do the same thing if I am sharing to personal account not page?
I can get the like counter after getting the user login of their facebook account. But can I get the number of video view as well? I saw there is a insight but is it only working for facebook page?
Thanks,
Alex

I finally change the whole way I did.
I upload the video to facebook page as admin role
I share the video post on the facebook page to personal wall
I found some reference to do #1
This show how to upload video to facebook page as admin. However, the access token he said is not permanent.
How to publish a post on a Facebook Fan Page as Page Owner or Admin in Graph API
This show you how to get a permanent access token for the page (this is a long steps for me!)
facebook: permanent Page Access Token?
After you posted the video to facebook page, it will return you a post id. The video on the facebook page has a permanent link like this:
https://www.facebook.com/{FACEBOOK_PAGE_ID}/videos/{POST_ID_FROM_THE_RETURN}
Now, you can share this link to your personal account using the facebook dialog or api if you want.
This make you able to upload video to facebook with description (and you can also add some links in the description if you want) without banned by the facebook prefill policy. And I think I can now add the "call to action" button to the end of the video and use the facebook page insight to check the view count.

Related

Is it possible to share a link to facebook page when clicking a link?

is it possible to share a link on Facebook page not in Facebook account timeline when clicking a link? All codes i saw in forum are sharing code to account timeline.

Share video on a page on facebook

I want to share a video from my site on a page on facebook, not on my profile.
For Eg: I want to share video on https://www.facebook.com/pages/Opticians/108277472608071
I have a button as post to wall. On clicking it the video should get uploaded on the above mentioned page. I searched a lot for this but I ended in getting only share button which shares the post/video to our profile. How can i share that video on a different page on facebook?
Any Help would be greatly appreciated.
The reference page for this API can be found here. And here is a Facebook Developers blog post related to your problem.
According to this resources Facebook provides graph-video.facebook.com endpoint, that can be used to upload a video to user's wall. You need to perform HTTP POST request to this endpoint passing video file in file POST parameter.

How to share picture or post via PHP SDK similar to a facebook share button?

I want to Share Photos on my profile when I post photo on my facebook page.
how can I do this with php sdk ?
Similar to the share link shown in this picture
http://g1303.hizliresim.com/17/8/kusyg.png

Facebook Cover Photo API using PHP

Has Facebook released any api for facebook cover photo?
I want to implement it using PHP language.
EDIT
I want to upload cover photo in facebook timeline using graph api PHP
There is an api for updating the cover photo on a page
http://developers.facebook.com/docs/reference/api/page/
It asks for a photo id which i guess is the id of a photo from the users album.
Actually, it is not possible to change the profile picture directly via Facebook Photo Graph API as no section mention about that.
However, we can do a trick by uploading user’s photo to Facebook via the API then redirect the user to uploaded photo URL with 1 added in querystring parameter as below:
http://www.facebook.com/photo.php?pid=xyz&id=abc&makeprofile=1
“&makeprofile=1″ is the main thing here and xyz/abc will be returned by Facebook. By adding the parameter, Facebook will auto change the profile picture of the current user with the uploaded picture above.
For more info:
http://4rapiddev.com/facebook-graph-api/php-change-facebook-profile-picture-with-graph-api/
You can upload photo to an album via graph api. Get the new photo id and redirect user to this url
"http://www.facebook.com/profile.php?preview_cover=" + photo_id
before that, you should inform the user that he/she will be redirected to facebook to page where they can set new cover photo (they need to confirm the change, click the save button). It's not perfect solution, and not fully covered api but it's best way out there asfaik.

Facebook social features on iframe app

We are developing a facebook iframe application that pulls some images (via an API) to the current user album (creates a new one).
The user views his newly uploaded album photos using a facebook lightbox clone. In this clone he must be able to comment and like the current viewed photo.
Is there a way to provide facebook comments & like to these pictures without the use of the Graph API (which would require us to replicate a lot of visuals).
Another try was the social plug-ins with the facebook photo url given but no success.
Any ideas?
I would recommend using the social plugins that facebook provide.
For the likes and comments you can specify a URL in the plugin code, that URL should be the URL of the photo relative to your app e.g. http://myapp.com/photo/123 and not the http://app.facebook.com address.
Facebook will need to be able to crawl that URL so if you are checking if the user is logged in via PHP then you should either disable this if the user agent contains facebookexternalhit or show a different page for that user agent. It doesn't matter about the content, just set a couple of og: meta tags and that should be fine.

Categories