1. Go to this page and download the library: Download zencoder/zencoder-php 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/ */
zencoder / zencoder-php example snippets
$zencoder = new Services_Zencoder($my_api_key, 'v2', 'https://app.zencoder.com', false, $my_curlopt_capath, $my_curlopt_cainfo);
$zencoder = new Services_Zencoder('93h630j1dsyshjef620qlkavnmzui3');
// Make sure this points to a copy of Zencoder.php on the same server as this script.
30j1dsyshjef620qlkavnmzui3');
// New Encoding Job
$encoding_job = $zencoder->jobs->create(
array(
"input" => "s3://bucket-name/file-name.avi",
"outputs" => array(
array(
"label" => "web"
)
)
)
);
// Success if we got here
echo "w00t! \n\n";
echo "Job ID: ".$encoding_job->id."\n";
echo "Output ID: ".$encoding_job->outputs['web']->id."\n";
// Store Job/Output IDs to update their status when notified or to check their progress.
} catch (Services_Zencoder_Exception $e) {
// If were here, an error occurred
echo "Fail :(\n\n";
echo "Errors:\n";
foreach ($e->getErrors() as $error) echo $error."\n";
echo "Full exception dump:\n\n";
print_r($e);
}
echo "\nAll Job Attributes:\n";
var_dump($encoding_job);
// Make sure this points to a copy of Zencoder.php on the same server as this script.
ef620qlkavnmzui3');
// Catch notification
$notification = $zencoder->notifications->parseIncoming();
// Check output/job state
if($notification->job->outputs[0]->state == "finished") {
echo "w00t!\n";
// If you're encoding to multiple outputs and only care when all of the outputs are finished
// you can check if the entire job is finished.
if($notification->job->state == "finished") {
echo "Dubble w00t!";
}
} elseif ($notification->job->outputs[0]->state == "cancelled") {
echo "Cancelled!\n";
} else {
echo "Fail!\n";
echo $notification->job->outputs[0]->error_message."\n";
echo $notification->job->outputs[0]->error_link;
}