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 other words, I have an ip camera operating at a given address:port and I can see the stream embedding in a HTML body something like this:
<img src="http://188.8.131.52:8080/videostream.cgi?user=myusername&pwd=mypass&resolution=32&rate=15" alt="">
<img src="http://184.108.40.206:8080/snapshot.cgi?user=myusername&pwd=mypass&" alt="">
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:
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