Post video on facebook wall using PHP

November 1, 2009
Filed under: FaceBook Integration, Featured, PHP 

First Follow the 5 Steps from my Previous post then in last program include the below code to publish a photo and also meta data on a facebook wall.

 *  Here is a comment!
$message = 'Watch this video!';
$attachment = array( 'name' => 'ninja cat', 'href' => '', 'caption' => '{*actor*} uploaded a video to', 'description' => 'a sneaky cat', 'properties' => array('category' => array( 'text' => 'pets', 'href' => ''), 'ratings' => '5 stars'), 'media' => array(array('type' => 'video', 'video_src' => '', 'preview_img' => '', 'video_link' => '', 'video_title' => 'ninja cat'))); 

$action_links = array( array('text' => 'Upload a video', 'href' => ''));
$target_id = 2342314; $facebook->api_client->stream_publish($message, $attachment, $action_links, $target_id);


Exiting isn’t it.

— Steven


11 Comments on Post video on facebook wall using PHP

  1. Bruno Gomes on Wed, 24th Mar 2010 10:18 pm
  2. Hello…
    Thanks for the code..
    I have a little question.. Do u have a script that uploads a photo to facebook.

  3. Steven Robert on Thu, 25th Mar 2010 10:10 am
  4. kamarul on Wed, 16th Jun 2010 1:48 am
  5. 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.

  6. Steven Robert on Wed, 16th Jun 2010 3:52 am
  7. Steven Robert on Wed, 16th Jun 2010 12:39 pm
  8. Kamarul did u followed all the steps?

  9. kamarul on Thu, 17th Jun 2010 9:51 am
  10. Hi Steven,

    Yes, i followed until step 5 and uploaded into server. But not working.

  11. Steven Robert on Thu, 17th Jun 2010 10:59 am
  12. Kamarul, what error you are getting?

  13. Ravi on Mon, 20th Sep 2010 3:28 am
  14. This really rocks are a genius. Thanks for the script

  15. baljeet on Mon, 29th Nov 2010 4:18 am
  16. 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 ?

  17. baljeet on Tue, 30th Nov 2010 4:26 am
  18. 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?


    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.


Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

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