Forgive me if I've posted this in the wrong place. I've been using the following script to grab images for sometime. Recently I've changed the ports my webcams output using and needed to be able to grab their output from another page (as my company won't allow access on any other port than 80). I know I'm probably doing this totally wrong..
function GrabImage($url,$filename="") {
if($url==""):return false;endif;
if($filename=="") {
$ext=strrchr($url,".");
if($ext!=".gif" && $ext!=".jpg"):return false;endif;
$filename="camimage.jpg";
}
ob_start();
readfile($url);
$img = ob_get_contents();
ob_end_clean();
$size = strlen($img);
$fp2=@fopen("/pathtodirectory/$filename", "w");
fwrite($fp2,$img);
fclose($fp2);
return $filename;
}
$img=GrabImage("http://myaddress:1030/jpg/fullsize.jpg","");
if($img):echo 'Success';else:echo "Failed";endif;
Any advice would be much appreciated, I'm guessing I need to 'open' the port a different way, but I'm having little luck with it