Skip to content

Instantly share code, notes, and snippets.

@dw5
Created May 18, 2019 07:20
Show Gist options
  • Save dw5/34b2aef83ff0abf21d83411b764c5043 to your computer and use it in GitHub Desktop.
Save dw5/34b2aef83ff0abf21d83411b764c5043 to your computer and use it in GitHub Desktop.
Post Video to http://vid.me using Tweetbot's custom media upload
<?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