bld-live.dk saving the environment, I think…

28Jul/100

CURL with image

This is the snippet I use for showing images from internally on my network. The idea is that only the web server is exposed to the internet, so it isn't possible to directly change anything on the picture server.

<?php
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,"http://10.0.0.50:8080/camera.jpg");
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);

if (empty($buffer))
	{
		print "Picture unavalible";
	}
	else
	{
		header('Content-Type: image/jpeg');
		print $buffer;
	}
?>
Filed under: PHP Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.