Created
May 18, 2019 07:20
-
-
Save dw5/34b2aef83ff0abf21d83411b764c5043 to your computer and use it in GitHub Desktop.
Post Video to http://vid.me using Tweetbot's custom media upload
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 | |
$uploadsDirectory="tmp/"; | |
$uploadFilename = $uploadsDirectory.$_FILES['media']['name']; | |
move_uploaded_file($_FILES['media']['tmp_name'], $uploadFilename); | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_URL, 'https://api.vid.me/video/upload'); | |
$postData = array( | |
'filedata' => '@'.$uploadFilename, | |
'description' => $_POST["message"], | |
); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); | |
$response = curl_exec($ch); | |
echo $response; | |
if (file_exists($uploadFilename)) { unlink ($uploadFilename); } | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment