Post video on facebook wall using PHP

First Follow the 5 Steps from my Previous post http://blog.theunical.com/facebook-integration/5-steps-to-publish-on-a-facebook-wall-using-php/ then in last program include the below code to publish a photo and also meta data on a facebook wall.

<?php
/**
 *  Here is a comment!
 */
$message = 'Watch this video!';
$attachment = array( 'name' => 'ninja cat', 'href' => 'http://www.youtube.com/watch?v=muLIPWjks_M', 'caption' => '{*actor*} uploaded a video to www.youtube.com', 'description' => 'a sneaky cat', 'properties' => array('category' => array( 'text' => 'pets', 'href' => 'http://www.youtube.com/browse?s=mp&t=t&c=15'), 'ratings' => '5 stars'), 'media' => array(array('type' => 'video', 'video_src' => 'http://www.youtube.com/v/fzzjgBAaWZw&hl=en&fs=1', 'preview_img' => 'http://img.youtube.com/vi/muLIPWjks_M/default.jpg?h=100&w=200&sigh=__wsYqEz4uZUOvBIb8g-wljxpfc3Q=', 'video_link' => 'http://www.youtube.com/watch?v=muLIPWjks_M', 'video_title' => 'ninja cat'))); 

$action_links = array( array('text' => 'Upload a video', 'href' => 'http://www.youtube.com/my_videos_upload'));
$target_id = 2342314; $facebook->api_client->stream_publish($message, $attachment, $action_links, $target_id);

?>

Exiting isn’t it.

— Steven

11 thoughts on “Post video on facebook wall using PHP”

  1. Hello…
    Thanks for the code..
    I have a little question.. Do u have a script that uploads a photo to facebook.
    Thanks.

  2. Dear Steven,

    Thank you for your script. Anyway, I got problem when publishing it on my wall. It just appear post on wall. nothing else. Hope you can help me out.

  3. i’ve changed the $target_id to my fan page id, and using this script to post video on my fan page. But getting this error:
    …..’The post’s links must direct to the application’s connect or canvas URL…….

    also I need to actually upload the video, does this same scriot will do by changing the video-src ?

  4. I was getting the error: ’The post’s links must direct to the application’s connect or canvas URL

    Then I changed the application settings: edit setting->advanced->Stream post URL security->disabled. Now it is uploading the video but does not show the thumbnail. How to show a thumbnail here?

    OR

    I also tried to upload the video using video_upload function, but it uploads the video on users wall not on fan page wall. How to post it to fan page wall because this function does not seem to take page id as parameter I guess.

    any one solution will help me, both solutions will help many of us.

    Thanks
    Baljeet

Leave a Reply

Your email address will not be published. Required fields are marked *

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image