{"id":224,"date":"2022-09-01T01:05:38","date_gmt":"2022-09-01T01:05:38","guid":{"rendered":"http:\/\/www.vdocipher.com\/blog\/?p=224"},"modified":"2022-09-28T13:00:02","modified_gmt":"2022-09-28T13:00:02","slug":"php-implementation-vdocipher-api","status":"publish","type":"post","link":"https:\/\/www-uat.vdocipher.com\/blog\/2014\/12\/php-implementation-vdocipher-api\/","title":{"rendered":"PHP implementation of VdoCipher API for Video Security"},"content":{"rendered":"<p><em><strong>Update 5 June 2018<\/strong> This implementation of VdoCipher Secure Streaming API is updated for latest API version v3, and for latest player version 1.6.4. A previous version of the blog used API v2. While we still support API version v2 we recommend that you use API v3 as part of your video workflow. If you have any queries regarding API v2 please do get in touch with us at <a href=\"mailto:support@vdocipher.com\" target=\"_blank\" rel=\"noopener noreferrer\">support@vdocipher.com<\/a>. The complete VdoCipher API reference is available <a href=\"https:\/\/dev.vdocipher.com\/api\/docs\/book\/\">here<\/a>.<\/em> A sample video-based workflow for your website is suggested <a href=\"https:\/\/www.vdocipher.com\/blog\/2018\/05\/video-api-v3\/\">here<\/a>.<\/p>\n<p>Here is a PHP\u00a0code to use VdoCipher API along with dynamic watermarking. You need to pass the video ID to the vdo_embed function in <code>embed_code.php<\/code> and the your API secret key to the <code>$api_key<\/code> variable in <code>vdo_embed.php<\/code>. The code should work out of the box after editing the details. The sample code is so structured that you only need to add <code>vdo_embed.php<\/code> once to your file system, and enter the embed code given in <code>embed_code.php<\/code> at each instance of video player.<\/p>\n<p><a href=\"https:\/\/gist.github.com\/milangupta4\/e171ab540f949d64ab07244236dacfab\">https:\/\/gist.github.com\/milangupta4\/e171ab540f949d64ab07244236dacfab<\/a><\/p>\n<p>The structure of annotation JSON is described in the link : <a href=\"https:\/\/www.vdocipher.com\/blog\/2014\/12\/add-text-to-videos-with-watermark\/\">Add text to videos with watermark<\/a>. To add user details you can create a <code>$userdetail<\/code> variable which will collect user-identifiable information such as name and email address from your website database, and append it to the watermark.<\/p>\n<h2>PHP Sample code to get OTP<\/h2>\n<p>In this example, the sample videoID is 1234567890, and the API Secret Key is a1b2c3d4e5. The time-to-live for OTP validity is set to 300s in the sample code. You can reference the API documentation for more info.<\/p>\n<p><code>$curl = curl_init();<br \/>\ncurl_setopt_array($curl, array(<br \/>\nCURLOPT_URL =&gt; \"https:\/\/dev.vdocipher.com\/api\/videos\/1234567890\/otp\",<br \/>\nCURLOPT_RETURNTRANSFER =&gt; true,<br \/>\nCURLOPT_ENCODING =&gt; \"\",<br \/>\nCURLOPT_MAXREDIRS =&gt; 10,<br \/>\nCURLOPT_TIMEOUT =&gt; 30,<br \/>\nCURLOPT_HTTP_VERSION =&gt; CURL_HTTP_VERSION_1_1,<br \/>\nCURLOPT_CUSTOMREQUEST =&gt; \"POST\",<br \/>\nCURLOPT_POSTFIELDS =&gt; json_encode([<br \/>\n\"ttl\" =&gt; 300,<br \/>\n]),<br \/>\nCURLOPT_HTTPHEADER =&gt; array(<br \/>\n\"Accept: application\/json\",<br \/>\n\"Authorization: Apisecret a1b2c3d4e5\",<br \/>\n\"Content-Type: application\/json\"<br \/>\n),<br \/>\n));<\/code><br \/>\n<code><br \/>\n$response = curl_exec($curl);<br \/>\n$err = curl_error($curl);<\/code><br \/>\n<code><br \/>\ncurl_close($curl);<\/code><br \/>\n<code><br \/>\nif ($err) {<br \/>\necho \"cURL Error #:\" . $err;<br \/>\n} else {<br \/>\necho $response;<br \/>\n}<\/code><\/p>\n<h2>FAQs<\/h2>\n<h3>How to protect your videos on the PHP backend?<\/h3>\n<p>The security integration of video streaming, like multi-DRM, is not directly available for PHP use. The easiest solution would be to use a secure video streaming service provider like VdoCipher and integrate with their APIs compatible with the PHP backend.<\/p>\n<h3>How to secure API in PHP?<\/h3>\n<p>API gets used as a documented method of interacting with other services, and that is why there is no exact answer to the question, but applying OAuth and using a shared secret along with the request made can work as generic solutions.<\/p>\n<h3>Is PHP vulnerable to Video Security lapses?<\/h3>\n<p>No, it has nothing to do with video security, as videos get secured through cloud encoding and global distribution via a dynamic key exchange mechanism.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update 5 June 2018 This implementation of VdoCipher Secure Streaming API is updated for latest API version v3, and for latest player version 1.6.4. A previous version of the blog used API v2. While we still support API version v2 we recommend that you use API v3 as part of your video workflow. If you [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46,47,25,14],"tags":[48,50,49,51],"class_list":{"0":"post-224","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-api","7":"category-php","8":"category-technology","9":"category-using-vdocipher","10":"tag-php","11":"tag-php-api","12":"tag-php-video-api","13":"tag-vdocipher-embed","14":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.0 (Yoast SEO v26.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>PHP implementation of VdoCipher API for Video Security - VdoCipher Blog<\/title>\n<meta name=\"description\" content=\"Here is a classic PHP\u00a0code to use VdoCipher API along with dynamic watermarking.\u00a0\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vdocipher.com\/blog\/2014\/12\/php-implementation-vdocipher-api\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PHP implementation of VdoCipher API for Video Security\" \/>\n<meta property=\"og:description\" content=\"Here is a classic PHP\u00a0code to use VdoCipher API along with dynamic watermarking.\u00a0\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www-uat.vdocipher.com\/blog\/2014\/12\/php-implementation-vdocipher-api\/\" \/>\n<meta property=\"og:site_name\" content=\"VdoCipher Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/vdociphertech\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-01T01:05:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-09-28T13:00:02+00:00\" \/>\n<meta name=\"author\" content=\"Vibhav Sinha\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vdocipher\" \/>\n<meta name=\"twitter:site\" content=\"@vdocipher\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vibhav Sinha\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www-uat.vdocipher.com\/blog\/2014\/12\/php-implementation-vdocipher-api\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www-uat.vdocipher.com\/blog\/2014\/12\/php-implementation-vdocipher-api\/\"},\"author\":{\"name\":\"Vibhav Sinha\",\"@id\":\"https:\/\/www.vdocipher.com\/blog\/#\/schema\/person\/44b7d612191edc5560c5cb64184d379c\"},\"headline\":\"PHP implementation of VdoCipher API for Video Security\",\"datePublished\":\"2022-09-01T01:05:38+00:00\",\"dateModified\":\"2022-09-28T13:00:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www-uat.vdocipher.com\/blog\/2014\/12\/php-implementation-vdocipher-api\/\"},\"wordCount\":406,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.vdocipher.com\/blog\/#organization\"},\"keywords\":[\"php\",\"php api\",\"php video api\",\"vdocipher embed\"],\"articleSection\":[\"APIs and Sample Codes\",\"PHP\",\"Technology\",\"Using VdoCipher\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www-uat.vdocipher.com\/blog\/2014\/12\/php-implementation-vdocipher-api\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www-uat.vdocipher.com\/blog\/2014\/12\/php-implementation-vdocipher-api\/\",\"url\":\"https:\/\/www-uat.vdocipher.com\/blog\/2014\/12\/php-implementation-vdocipher-api\/\",\"name\":\"PHP implementation of VdoCipher API for Video Security - VdoCipher Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.vdocipher.com\/blog\/#website\"},\"datePublished\":\"2022-09-01T01:05:38+00:00\",\"dateModified\":\"2022-09-28T13:00:02+00:00\",\"description\":\"Here is a classic PHP\u00a0code to use VdoCipher API along with dynamic watermarking.\u00a0\",\"breadcrumb\":{\"@id\":\"https:\/\/www-uat.vdocipher.com\/blog\/2014\/12\/php-implementation-vdocipher-api\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www-uat.vdocipher.com\/blog\/2014\/12\/php-implementation-vdocipher-api\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www-uat.vdocipher.com\/blog\/2014\/12\/php-implementation-vdocipher-api\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vdocipher.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PHP implementation of VdoCipher API for Video Security\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.vdocipher.com\/blog\/#website\",\"url\":\"https:\/\/www.vdocipher.com\/blog\/\",\"name\":\"VdoCipher Blog\",\"description\":\"Secure Video Streaming\",\"publisher\":{\"@id\":\"https:\/\/www.vdocipher.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.vdocipher.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.vdocipher.com\/blog\/#organization\",\"name\":\"VdoCipher\",\"url\":\"https:\/\/www.vdocipher.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vdocipher.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.vdocipher.com\/blog\/wp-content\/uploads\/2016\/11\/VdoCipher-logo2.png\",\"contentUrl\":\"https:\/\/www.vdocipher.com\/blog\/wp-content\/uploads\/2016\/11\/VdoCipher-logo2.png\",\"width\":1625,\"height\":1925,\"caption\":\"VdoCipher\"},\"image\":{\"@id\":\"https:\/\/www.vdocipher.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/vdociphertech\/\",\"https:\/\/x.com\/vdocipher\",\"https:\/\/www.linkedin.com\/company\/vdocipher\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.vdocipher.com\/blog\/#\/schema\/person\/44b7d612191edc5560c5cb64184d379c\",\"name\":\"Vibhav Sinha\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vdocipher.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/21359ad936924de4c06b12ee192755a4337f15761710afc5877a6f943f1c8a47?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/21359ad936924de4c06b12ee192755a4337f15761710afc5877a6f943f1c8a47?s=96&r=g\",\"caption\":\"Vibhav Sinha\"},\"description\":\"(Co-Founder &amp; CTO) Brain behind all VdoCipher innovations, Vibhav eats and sleeps code. A physics and astronomy enthusiast; Vibhav actively works on video delivery technology, security and high volume data transfer using cloud.\",\"url\":\"https:\/\/www-uat.vdocipher.com\/blog\/author\/vibhavsinha\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"PHP implementation of VdoCipher API for Video Security - VdoCipher Blog","description":"Here is a classic PHP\u00a0code to use VdoCipher API along with dynamic watermarking.\u00a0","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vdocipher.com\/blog\/2014\/12\/php-implementation-vdocipher-api\/","og_locale":"en_US","og_type":"article","og_title":"PHP implementation of VdoCipher API for Video Security","og_description":"Here is a classic PHP\u00a0code to use VdoCipher API along with dynamic watermarking.\u00a0","og_url":"https:\/\/www-uat.vdocipher.com\/blog\/2014\/12\/php-implementation-vdocipher-api\/","og_site_name":"VdoCipher Blog","article_publisher":"https:\/\/www.facebook.com\/vdociphertech\/","article_published_time":"2022-09-01T01:05:38+00:00","article_modified_time":"2022-09-28T13:00:02+00:00","author":"Vibhav Sinha","twitter_card":"summary_large_image","twitter_creator":"@vdocipher","twitter_site":"@vdocipher","twitter_misc":{"Written by":"Vibhav Sinha","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www-uat.vdocipher.com\/blog\/2014\/12\/php-implementation-vdocipher-api\/#article","isPartOf":{"@id":"https:\/\/www-uat.vdocipher.com\/blog\/2014\/12\/php-implementation-vdocipher-api\/"},"author":{"name":"Vibhav Sinha","@id":"https:\/\/www.vdocipher.com\/blog\/#\/schema\/person\/44b7d612191edc5560c5cb64184d379c"},"headline":"PHP implementation of VdoCipher API for Video Security","datePublished":"2022-09-01T01:05:38+00:00","dateModified":"2022-09-28T13:00:02+00:00","mainEntityOfPage":{"@id":"https:\/\/www-uat.vdocipher.com\/blog\/2014\/12\/php-implementation-vdocipher-api\/"},"wordCount":406,"commentCount":0,"publisher":{"@id":"https:\/\/www.vdocipher.com\/blog\/#organization"},"keywords":["php","php api","php video api","vdocipher embed"],"articleSection":["APIs and Sample Codes","PHP","Technology","Using VdoCipher"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www-uat.vdocipher.com\/blog\/2014\/12\/php-implementation-vdocipher-api\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www-uat.vdocipher.com\/blog\/2014\/12\/php-implementation-vdocipher-api\/","url":"https:\/\/www-uat.vdocipher.com\/blog\/2014\/12\/php-implementation-vdocipher-api\/","name":"PHP implementation of VdoCipher API for Video Security - VdoCipher Blog","isPartOf":{"@id":"https:\/\/www.vdocipher.com\/blog\/#website"},"datePublished":"2022-09-01T01:05:38+00:00","dateModified":"2022-09-28T13:00:02+00:00","description":"Here is a classic PHP\u00a0code to use VdoCipher API along with dynamic watermarking.\u00a0","breadcrumb":{"@id":"https:\/\/www-uat.vdocipher.com\/blog\/2014\/12\/php-implementation-vdocipher-api\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www-uat.vdocipher.com\/blog\/2014\/12\/php-implementation-vdocipher-api\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www-uat.vdocipher.com\/blog\/2014\/12\/php-implementation-vdocipher-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vdocipher.com\/blog\/"},{"@type":"ListItem","position":2,"name":"PHP implementation of VdoCipher API for Video Security"}]},{"@type":"WebSite","@id":"https:\/\/www.vdocipher.com\/blog\/#website","url":"https:\/\/www.vdocipher.com\/blog\/","name":"VdoCipher Blog","description":"Secure Video Streaming","publisher":{"@id":"https:\/\/www.vdocipher.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vdocipher.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.vdocipher.com\/blog\/#organization","name":"VdoCipher","url":"https:\/\/www.vdocipher.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vdocipher.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.vdocipher.com\/blog\/wp-content\/uploads\/2016\/11\/VdoCipher-logo2.png","contentUrl":"https:\/\/www.vdocipher.com\/blog\/wp-content\/uploads\/2016\/11\/VdoCipher-logo2.png","width":1625,"height":1925,"caption":"VdoCipher"},"image":{"@id":"https:\/\/www.vdocipher.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/vdociphertech\/","https:\/\/x.com\/vdocipher","https:\/\/www.linkedin.com\/company\/vdocipher"]},{"@type":"Person","@id":"https:\/\/www.vdocipher.com\/blog\/#\/schema\/person\/44b7d612191edc5560c5cb64184d379c","name":"Vibhav Sinha","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vdocipher.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/21359ad936924de4c06b12ee192755a4337f15761710afc5877a6f943f1c8a47?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/21359ad936924de4c06b12ee192755a4337f15761710afc5877a6f943f1c8a47?s=96&r=g","caption":"Vibhav Sinha"},"description":"(Co-Founder &amp; CTO) Brain behind all VdoCipher innovations, Vibhav eats and sleeps code. A physics and astronomy enthusiast; Vibhav actively works on video delivery technology, security and high volume data transfer using cloud.","url":"https:\/\/www-uat.vdocipher.com\/blog\/author\/vibhavsinha\/"}]}},"yoast":{"focuskw":"VdoCipher PHP API","title":"","metadesc":"Here is a classic PHP\u00a0code to use VdoCipher API along with dynamic watermarking.\u00a0","linkdex":"63","metakeywords":"","meta-robots-noindex":"","meta-robots-nofollow":"","meta-robots-adv":"","canonical":"","redirect":"","opengraph-title":"","opengraph-description":"","opengraph-image":"","twitter-title":"","twitter-description":"","twitter-image":""},"_links":{"self":[{"href":"https:\/\/www-uat.vdocipher.com\/blog\/wp-json\/wp\/v2\/posts\/224","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www-uat.vdocipher.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www-uat.vdocipher.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www-uat.vdocipher.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www-uat.vdocipher.com\/blog\/wp-json\/wp\/v2\/comments?post=224"}],"version-history":[{"count":2,"href":"https:\/\/www-uat.vdocipher.com\/blog\/wp-json\/wp\/v2\/posts\/224\/revisions"}],"predecessor-version":[{"id":12149,"href":"https:\/\/www-uat.vdocipher.com\/blog\/wp-json\/wp\/v2\/posts\/224\/revisions\/12149"}],"wp:attachment":[{"href":"https:\/\/www-uat.vdocipher.com\/blog\/wp-json\/wp\/v2\/media?parent=224"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www-uat.vdocipher.com\/blog\/wp-json\/wp\/v2\/categories?post=224"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www-uat.vdocipher.com\/blog\/wp-json\/wp\/v2\/tags?post=224"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}