Skip to content Skip to sidebar Skip to footer

Embedding Image/video Stream Into Webpage

I'm trying to create a PHP webpage that allow the visitor to see a video stream or an image coming from a webcam without allowing the visitors to grab it's original URL/URI. In oth

Solution 1:

Well, at least for images you could use curl... As I've pointed out in the comments, you may create a php file (say, my.php) containing something like the following:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com/?password=4444&login=1111');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
$picture = curl_exec($ch);
curl_close($ch);
//Display the image in the browser
header('Content-type: image/jpeg');
echo$picture;

and than just write:

<imgsrc='my.php'>

P.S. Although I believe it is NOT the best way to do things, it looks like it solves the problem. No more private data in img src. I have never anything alike with video formats, but as for images it seems quite easy. You can read more about curl here: http://php.net/manual/en/book.curl.php

Solution 2:

Another solution using above mentioned passthru:

<?php 
Header("content-type:image/jpeg"); 
passthru("pic.jpg?login=11&pass=22"); 
?>

However, it is still only for images, because of the header... If you find anything that works with videos/video streaming, please, let me know!!

Post a Comment for "Embedding Image/video Stream Into Webpage"