Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2ddc539

Browse files
author
Michael Christopher
committed
Fixed typos, updated error handling, expanded README
1 parente1f7be3 commit2ddc539

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

‎README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,21 @@ Repository: <http://github.com/zencoder/zencoder-php/>
1010
For more details on the Zencoder API requirements visit
1111
<http://app.zencoder.com/docs/api>
1212

13+
To start working with the library, create a new instance of the Services_Zencoder class, passing
14+
your API Key as the 1st parameter.
15+
$zencoder = new Services_Zencoder('93h630j1dsyshjef620qlkavnmzui3');
16+
17+
Once you have created the object, you can use it to interact with the API. For full information,
18+
see the Documentation folder, but here is a quick overview of some of the functions that can be
19+
called:
20+
21+
$zencoder->accounts->create($array);
22+
$zencoder->jobs->create($array);
23+
$zencoder->jobs->progress($job_id);
24+
$zencoder->inputs->details($input_id);
25+
$zencoder->outputs->details($output_id);
26+
$zencoder->notifications->parseIncoming();
27+
1328

1429
ENCODING JOB
1530
------------
@@ -85,7 +100,6 @@ The previous JSON example would become:
85100
)
86101
));
87102

88-
89103
NOTIFICATION HANDLING
90104
----------------------
91105
The ZencoderOutputNotification class is used to capture and parse JSON data sent from

‎Services/Zencoder.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ public function __construct(
5757
$api_version ='v2',
5858
$api_host ='https://app.zencoder.com'
5959
) {
60+
// Check that library dependencies are met
61+
if (strnatcmp(phpversion(),'5.2.0') <0) {
62+
thrownewServices_Zencoder_Exception('PHP version 5.2 or higher is required.');
63+
}
64+
if (!function_exists('json_encode')) {
65+
thrownewServices_Zencoder_Exception('JSON support must be enabled.');
66+
}
67+
if (!function_exists('curl_init')) {
68+
thrownewServices_Zencoder_Exception('cURL extension must be enabled.');
69+
}
6070
$this->version =$api_version;
6171
$this->http =newServices_Zencoder_Http(
6272
$api_host,
@@ -120,7 +130,7 @@ public function createData($path, $body = "", array $opts = array())
120130
?$this->_processResponse($this->http->post($this->_getApiPath($opts) .$path,$headers))
121131
:$this->_processResponse(
122132
$this->http->post(
123-
$path,
133+
$this->_getApiPath($opts) .$path,
124134
$headers,
125135
$body
126136
)
@@ -143,7 +153,7 @@ public function updateData($path, $body = "", array $opts = array())
143153
?$this->_processResponse($this->http->put($this->_getApiPath($opts) .$path,$headers))
144154
:$this->_processResponse(
145155
$this->http->put(
146-
$path,
156+
$this->_getApiPath($opts) .$path,
147157
$headers,
148158
$body
149159
)
@@ -187,10 +197,8 @@ private function _processJsonResponse($status, $headers, $body) {
187197
return$decoded;
188198
}
189199
thrownewServices_Zencoder_Exception(
190-
(int)$decoded->status,
191-
$decoded->message,
192-
isset($decoded->code) ?$decoded->code :null,
193-
isset($decoded->more_info) ?$decoded->more_info :null
200+
"Invalid HTTP status code:" .$status
201+
.", body:" .$body
194202
);
195203
}
196204
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp