/** * @static * @param $guid * @param $title * @param $description * @param $labels * @param int $width * @param int $bitrate * @param bool $transcoding * @param string $replace * @return mixed */ public static function processVideoCustomized($guid, $title, $description, $labels, $width = 200, $bitrate = 256, $transcoding = false, $replace = '') { $_url = self::$url . "api/videos"; if ($replace != '') { $replace = '<replace_id>' . $replace . '</replace_id>'; } $req = Vzaar::setAuth($_url, 'POST'); $data = '<vzaar-api> <video>' . $replace . ' <guid>' . $guid . '</guid> <title>' . $title . '</title> <description>' . $description . '</description> <labels>' . $labels . '</labels> <profile>' . Profile::Custom . '</profile> <encoding> <width>' . $width . '</width> <bitrate>' . $bitrate . '</bitrate> </encoding>'; if ($transcoding) { $data .= '<transcoding>true</transcoding>'; } $data .= '</video> </vzaar-api>'; $c = new HttpRequest($_url); $c->verbose = Vzaar::$enableHttpVerbose; $c->method = 'POST'; array_push($c->headers, $req->to_header()); array_push($c->headers, 'User-Agent: Vzaar OAuth Client'); array_push($c->headers, 'Connection: close'); array_push($c->headers, 'Content-Type: application/xml'); $apireply = new XMLToArray($c->send($data)); return $apireply->_data[0]["vzaar-api"]["video"]; }
<?php require_once '../src/Vzaar.php'; Vzaar::$token = "token"; Vzaar::$secret = "secret"; $req = Vzaar::setAuth('https://vzaar.com/api/test/whoami.json'); header('Content-type: text/plain'); echo $req->to_header();