Created
July 26, 2016 19:06
-
-
Save henriqueboaventura/2e0dd51d1821a0d5385dd602325ebc11 to your computer and use it in GitHub Desktop.
publish video youtube
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//use o seguinte comando :D | |
//ffmpeg -f gif -i teste.gif teste.mp4 | |
$app_id = "125178627581346"; | |
$app_secret = "9fcc6b62c0f23c337d8ecb9aec27d155"; | |
$my_url = "http://hml27.com/video"; | |
$video_title = "YOUR_VIDEO_TITLE"; | |
$video_desc = "YOUR_VIDEO_DESCRIPTION"; | |
$code = $_REQUEST["code"]; | |
if(empty($code)) { | |
$dialog_url = "http://www.facebook.com/dialog/oauth?client_id=" | |
. $app_id . "&redirect_uri=" . urlencode($my_url) | |
. "&scope=publish_actions"; | |
echo("<script>top.location.href='" . $dialog_url . "'</script>"); | |
} | |
$token_url = "https://graph.facebook.com/oauth/access_token?client_id=" | |
. $app_id . "&redirect_uri=" . urlencode($my_url) | |
. "&client_secret=" . $app_secret | |
. "&code=" . $code; | |
$access_token = file_get_contents($token_url); | |
$post_url = "https://graph-video.facebook.com/me/videos?" | |
. "title=" . $video_title. "&description=" . $video_desc | |
. "&". $access_token; | |
echo '<form enctype="multipart/form-data" action=" '.$post_url.' " | |
method="POST">'; | |
echo 'Please choose a file:'; | |
echo '<input name="file" type="file">'; | |
echo '<input type="submit" value="Upload" />'; | |
echo '</form>'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment