PHP code example of sbrimon / streamtape-php-client
1. Go to this page and download the library: Download sbrimon/streamtape-php-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sbrimon / streamtape-php-client example snippets
// Include the Streamtape class
tape login and API key
//login= API-Login
//key= API-Key / API-Password
$streamtape = new Streamtape('your_login', 'your_api_key');
// Get account information
$AccountInfo = $streamtape->AccountInfo()->toArray();
echo "Email: " . $AccountInfo['email'] . "\n";
// File to upload (using $_FILES array)
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$file = $_FILES['file']; // Ensure 'file' is from an HTML form
$upload = $streamtape->Upload($file,'my video title.mp4','folderid'); //video name and folder id are optional.
///json return
echo "Upload Response: " . $upload->json();
//or
//Array Return
print_r($upload->toArray());
}
// Add a remote upload from a URL
$streamtape->RemoteUpload('https://example.com/myfile.mp4');
echo "Remote Upload Response: " . $streamtape->json();
// Remove a specific remote upload
$streamtape->RemoveRemoteUpload('remote_upload_id');
echo "Remote Upload Removal: " . $streamtape->json();