Reputation: 796
I want my IP cam streaming on my website. Since I have this piece of code but if you look at the source code, you'll see of course the complete data as user and pass. That is not the intention, I looked at RewriteRule option in .htaccess but don't know how to formulate, or maybe another solution to protect my user and pass data. Who can help me get out the thinking circle and gives a move in the right direction (or example).
<?php
$url = '123.456.7.890:1234';
$user = 'naam';
$pass = 'wachtwoord';
$cam = "http://$url/videostream.cgi?user=$user&pwd=$pass";
?>
<html>
<body>
...
<img name="main" id="main" border="0" width="640" height="480" src="<?php echo("$cam"); ?>">
...
</body>
</html>
Upvotes: 0
Views: 269
Reputation: 1137
You should use your server side to create a image. Solution can be found here: Create Image From Url Any File Type
You can create a PHP file that outputs the image or something.
If you do that, you can load the image like this: <img src="http://domain.com/image.php?id=1">
Then in image.php, you can load from your DB, or whatever you like. However, when you have the real image info, you can make a "fake" image as descriped in the link above.
Upvotes: 0
Reputation: 8668
If camera response you with image you can get it in PHP code and then add it to image src like base64 data.
For example
<?php
$url = '123.456.7.890:1234';
$user = 'naam';
$pass = 'wachtwoord';
$cam = "http://$url/videostream.cgi?user=$user&pwd=$pass";
$image = file_get_contents($cam); // Or use CURL
// Here you need to replace $type of your camera
$image_src = 'data:image/' . $type . ';base64,' . base64_encode($image);
?>
<html>
<body>
...
<img name="main" id="main" border="0"
width="640" height="480" src="<?php echo $image_src ?>">
...
</body>
</html>
Upvotes: 1