How to hide/encrypt vimeo video URL from source code in PHP? - php

I have following code
<iframe src="https://player.vimeo.com/video/250356669" width="740" height="370" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="" __idm_id__="321146881">
</iframe>
It is my requirement to use only Vimeo videos so my question is how can I encrypt the video URL so that no user able to see that URL from where the video is coming from?
My requirement
<iframe src="something-ecrypted-instead-of-vimeo-url" width="740" height="370" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="" __idm_id__="321146881">
</iframe>
Any help will be aprecaited.
Thanks.

Its worth noting firstly that the URL in your example is not a video URL but a URL to HTML 'page' which is inserted into your iframe. This HTML includes the HTML markup, player etc as well as the actual video URL for the video which will play.
If you just want to change your code so the code on your page shows no mention of Vimeo you could have an URL in the source for a proxy on your server which then redirects to the Vimeo URL.
However, as others have pointed out in the comments, this will not really divert or fool anyone who might actually want to understand the page or look at the source as it is very easy to follow the links or to monitor the network activity on a browser. IN very simple terms, if it is sent to your browser then someone can capture it.
If you are concerned with someone copying your material, then the standard approach is not to try to prevent people finding it, but to encrypt it and protect the keys with some sort of DRM mechanism. Vimeo say that they support DRM for 'select Vimeo On Demand partners' - not sure what exactly is needed to qualify for this.

Related

Embedding Video Stream into webpage

This is a progress after the question Embedding Image/Video Stream into webpage that was answered for the picture only using curl, video is still an open issue.
Resuming, I need to avoid that the visitor of a web page see the real source of an image streming. So I want to embed the video a some wrapper php page that doesnt use any userid/password but is under my control. Embedding the video stream into any HTML page it's really easy:
<img src="http://5.246.77.89:8090/videostream.cgi?user=stack&pwd=overflow&resolution=32&rate=15" alt="">
For some time I'll give you the opportunity to test the source of the video streaming that I want to hide here
http://93.58.198.189:8090/videostream.cgi?user=stack&pwd=overflow&resolution=32&rate=15
Now all I need is a simple web page let say video.php that is able to stream the video without asking credentials and hiding the original source IP, something like
<img src='my.php'>
How can I obtain this behavior?
Note that despite the source is a video stream, the header is image/jpeg as you can see by yourself and it works with any browser. I've tried to use
<?php
header("content-type:image/jpeg");
passthru("http://93.58.198.189:8090/videostream.cgi?user=stack&pwd=overflow&resolution=32&rate=15");
?>
but for some reason doesn't work. Any idea?
Good question, i was also had a same problem.
Now its solved for me. just you can go to you tube video url where your video is stored and below the video there is share ad embed, you go to embed and there you will get a url which can be embeded to your video.php. it works.

Change video id in youtube embed code with query value

what I want to do basically, is to take the parameters from the html page and place it as video ID into the youtube embedded code, so when the page loads, it shows the embedded player of the corresponding video.
How I want it to work, is to have buttons on a web page that will link to a video.html page with the video id in parameters, and load the corresponding video.
I know I probably have to use javascript or php, but I don't know both of them so explain as clearly as possible please. So I want to replace "VIDEOID" with my query string as simply as possible.
<iframe width="560" height="315" src="http://www.youtube.com/embed/"VIDEOID" frameborder="0" allowfullscreen></iframe>
thanks in advance.
Try to follow this code to get parameter value from url in html
Hope its helpful for you..

SimplePie parsing to Find Youtube Video link

I'm using SimplePie to parse our church RSS Feed which contains weekly sermons, both audio and video. I'm able to get the title and mp3 link, but having a difficult time getting the youtube link. Below is a sample of what is in the XML feed containing the youtube video.
It's using [CDATA]
I'm using $item->get_content(), but that doesn't seem to contain any of the tag data below. The url for the feed is http://lakeforest.org/feed. When I bring this url up in the browser I can see the embedded youtube video.
Any help would be greatly appreciated.
NOTE: - i commented the html below for display only
<!--
<description><![CDATA[Huntersville Campus Mike Moses, Lead Pastor Series Discussion Questions: SHAPE, Part 2 Spiritual Gifts Inventory VIDEO AUDIO]]></description>
<content:encoded><![CDATA[<h3>Huntersville Campus</h3>
<p>Mike Moses, Lead Pastor<br />
Series Discussion Questions: SHAPE, Part 2<br />
Spiritual Gifts Inventory</p>
<h4>VIDEO</h4>
<p><iframe width="420" height="315" src="http://www.youtube.com/embed/4Uv8U8c6isg" frameborder="0" allowfullscreen></iframe></p>
<h4>AUDIO</h4>
<img src="http://feeds.feedburner.com/~r/LakeForest/~4/qMoLVpI1tGI" height="1" width="1"/>]]> -->
SimplePie strips out embed, object, iframe etc tags by default as they can be dangerous.
You should ignore them if you want the video back, but be careful with the source url as it could be a security issue.
$feed = new SimplePie();
$feed->set_feed_url('http://simplepie.org/blog/feed/');
// Remove these tags from the list
$strip_htmltags = $feed->strip_htmltags;
array_splice($strip_htmltags, array_search('object', $strip_htmltags), 1);
array_splice($strip_htmltags, array_search('param', $strip_htmltags), 1);
array_splice($strip_htmltags, array_search('embed', $strip_htmltags), 1);
array_splice($strip_htmltags, array_search('iframe', $strip_htmltags), 1);
$feed->strip_htmltags($strip_htmltags);
Source
I just noticed your feed URL, that wasn't what I was expecting, I was expecting something like this:
http://gdata.youtube.com/feeds/base/videos?q=painting+miniatures+tutorial&orderby=published&client=ytapi-youtube-search&v=2
That is a search result feed from YouTube which I pass to SimplePie here. Also the rest of your PHP code where you declare $item would be useful. I answered a similar question tonight and basically over the years YouTube has changed their API and feeds, you might have to update to a newer version of their API/feed even if you can find old examples of it working.
SimplePie can handle some if not all YouTube feeds, but there is no guarantee Google (YouTube) will give you a thumbnail and all the metadata they have on YouTube.com. APIs usually make a subset of the data contained in their database available via APIs, they want people to come to their website so they can show them ads and track them better.
Not the answer you want perhaps but without more information, that is the best I can do.
If you want to dig into the feed and get the video URL and then create a player for it, that is non-trivial. You have to use something like simple_html_dom then you need to create a properly formatted iframe or javascript call to create the in browser player. SimplePie doesn't have a get_contents()->video

YouTube embed and PHP

I allowed the user to upload a YouTube embed link that will display the video on their profile page. However, as my current code runs, it does not work. I echoed the field successfully from the database that holds the youtube embed link so I know the php code is working in terms of extracting the link. I then replace the PHP code and put the actual link in the src attribute but it still does not work. Here is the code below.
<iframe width="420" height="315"
src="<?php echo $detailed_profile_data['video_1'];?>"
frameborder="1" allowfullscreen>
</iframe>
The function detailed_profile_data grabs the link the user submitted to the database.This is what it returns. youtu.be/yWk7FOnFvGs
You might want to use oEmbed to find out the actual embeddable URL from the URL that user submits.
This Stack Overflow article might help: How can I retrieve YouTube video details from video URL using PHP?

PHP to view PDF on web page and disable user to download

I'm going to write a site that lets users to view pdf files but I don't want them to save the files to their own hard drive due to the copy right law. I'm researching how to view it by using PHP, but I have no idea how to disable user not to download the files.
Actually, I want to use JavaScript to disable this action, but I get suggestions from other people not to do so because it's annoying to user.
So any suggestion or help would be very much appreciated.
USE CSS opacity: 1.0 with a <div> positioned over your content...
You could output the pdf using <object> or <iframe>, then place a with absolute position and use z-index to cover your pdf. Use the css opacity: 1.0.
Now when users try to click or copy, they get nothing because they are really clicking on a blank <div>!!!!
Its a hack, but it works! The user will be able to read the content, they could take a screen shot, but they won't be able to actually copy the text and paste it anywhere.
Method 01
Implementing that useing Google books
<iframe frameborder="0" scrolling="no" style="border:0px" src="https://books.google.com.kh/books?id=e5MkzETNcsgC&lpg=PP1&dq=typography&pg=PA11&output=embed" width="500" height=500>
</iframe>
In above image it shows Embed that will be the code. And Download or Print option is not available on this. Google dosc can prevent download but its allow to Save to Drive option. Then in drive i can download it. But Google books not allow any of that.
in view
Method 02
Using Google Drive
Right click on pdf and goto Share(below image)
Then go to Advanced option in left bottom
Tick Both check boxes. After copy embed link and paste it to your src. No download and Save drive option is not allowed
Note: Method 01 and Method 02 is Tested
You can't prevent your visitors from downloading, copying or scrapping anything you're outputting to their browsers. If they can view it they can always screenshot it. Which brings in the optimal solution to your problem: Simply offer image copies of your documents instead of actual PDF files. You can convert / mass convert PDF files to JPEG easily with Photoshop.
I hope I am not very late to reply. But here's is something you can do to prevent the users. Use iFrame to display your PDF and make sure that you are displaying using Google. I used the following code :
<iframe src="http://docs.google.com/gview?url=http://www.tutorialspoint.com/php/php_tutorial.pdf&embedded=true" style="width:600px; height:500px;" frameborder="0">
</iframe>
Here you can simply change the url=http://www.tutorialspoint.com/php/php_tutorial.pdf and replace it by your own URL where you kept your PDF.
Try this one:
<iframe src="test1.pdf" scrolling="no" frameborder="0" height="100%" width="100%" style="position:absolute; clip:rect (190px,1100px,800px,250px);">
try this
<embed src="http://URL_TO_PDF.com/pdf.pdf#toolbar=0&navpanes=0&scrollbar=0" width="500" height="500">

Categories