public
Last active

PHP authentication example to Ankoder. (Thanks to GangOfCoders)

  • Download Gist
Ankoder PHP library
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
<?php
 
$ankoder_access_key = "GET YOUR ACCESS KEY FROM SETTINGS";
$private_key = "GET YOUR ACCESS KEY FROM SETTINGS";
$ankoder_date = date("r");
$ankoder_action = "GET";
$ankoder_path = "/video.xml";
$string = "-{$ankoder_date}-{$ankoder_action}-{$ankoder_path}-";
 
$salt = substr(sha1($string),0, 20);
 
$passkey = trim(base64_encode(hash_hmac('sha1', $salt, $private_key, true)));
 
$url = "http://api.ankoder.com/video.xml";
$curl = curl_init();
$header = array("ankoder_access_key: $ankoder_access_key", "ankoder_passkey: $passkey", "ankoder_date: $ankoder_date");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_exec($curl);
curl_close($curl);

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.