Skip to content

Commit 41233ca

Browse files
committed
added get_status example, updated composer version in readme
1 parent 5f0d762 commit 41233ca

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ PHP library for interacting with the Qencode API.
1313
```json
1414
{
1515
"require": {
16-
"qencode/api-client": "1.03.*"
16+
"qencode/api-client": "1.05.*"
1717
}
1818
}
1919
```

examples/get_status.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
require_once __DIR__ . '/../autoload.php';
3+
4+
use Qencode\Exceptions\QencodeApiException;
5+
use Qencode\Exceptions\QencodeException;
6+
use Qencode\QencodeApiClient;
7+
use Qencode\Classes\TranscodingTask;
8+
9+
//This example gets task status from main api endpoint (api.qencode.com)
10+
11+
$api_endpoint = 'https://api.qencode.com';
12+
//replace with your api key
13+
$apiKey = 'acbde123456';
14+
//replace with your task token value
15+
$task_token = 'fd17cc37c84f1233c0f62d6abcde123';
16+
$status_url = $api_endpoint.'/v1/status';
17+
$q = new QencodeApiClient($apiKey, $api_endpoint);
18+
19+
$params = array('task_tokens[]' => $task_token);
20+
$response = $q->post($status_url, $params);
21+
$status = $response['statuses'][$task_token];
22+
if ($status == null) {
23+
throw new QencodeClientException('Task '. $task_token. ' not found!');
24+
}
25+
if (array_key_exists('status_url', $status)) {
26+
$status_url = $status['status_url'];
27+
}
28+
print_r($status);

0 commit comments

Comments
 (0)