且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用 PHP 通过 Graph API 将视频发布到 Facebook

更新时间:2023-12-02 17:49:34

假设您已经将视频上传到您的服务器...

Assuming that you have already uploaded the video on your server...

  $config = array();
  $config['appId'] = 'appID';
  $config['secret'] = 'secretID';
  $config['fileUpload'] = true; 
  $config['cookie'] = true;

  $facebook = new Facebook($config);
  $facebook->setFileUploadSupport(true);  


  $video_details = array(   
            'access_token'=> 'user publish token',
            'message'=> 'Test video!',
            'source'=> '@' .realpath($videosPathOnServer)   

    );

 $post_video = $facebook->api('/'.$usersFacebookID.'/videos', 'post', $video_details);

据我所知,默认情况下所有视频的可见性都设置为朋友和他们的朋友

As far as I remember, by default all videos visibility is set to Friends and their Friends