Skip to content

Commit 01c5f1d

Browse files
committed
Added example for callback (webhook) script
Read more about callbacks: https://docs.qencode.com/navigate/index/010#010_080
1 parent f0fafd2 commit 01c5f1d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

examples/callback_example.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/**
3+
* Receives a callback from Qencode when a job is completed.
4+
* Prints out job status and output video URL(s)
5+
*/
6+
7+
$logfile = date('Y-m-d_H-i-s').'.log';
8+
$job_info = json_decode($_POST['status']);
9+
$log = "Job status: {$job_info->status}\n";
10+
if ($job_info->status == 'completed') {
11+
foreach ($job_info->videos as $video) {
12+
$log .= "URL: {$video->url}\n";
13+
}
14+
15+
}
16+
print $log;
17+
file_put_contents($logfile, $log);

0 commit comments

Comments
 (0)