php fopen:身份验证错误:访问被拒绝,身份验证协议错误
我喜欢用php读取一个mjpeg流,从流中分割出一个jpg图像。该流将从我的网络摄像头创建。网络摄像头有密码保护 这是我的代码:php fopen:身份验证错误:访问被拒绝,身份验证协议错误,php,authentication,fopen,mjpeg,Php,Authentication,Fopen,Mjpeg,我喜欢用php读取一个mjpeg流,从流中分割出一个jpg图像。该流将从我的网络摄像头创建。网络摄像头有密码保护 这是我的代码: function mjpeg2jpg_convert(){ $camurl="http://admin:secretpass@192.168.1.60/Streaming/Channels/1/httppreview"; $boundary="\n--"; $f = fopen($camurl,"r") ; if(!$f) { //
function mjpeg2jpg_convert(){
$camurl="http://admin:secretpass@192.168.1.60/Streaming/Channels/1/httppreview";
$boundary="\n--";
$f = fopen($camurl,"r") ;
if(!$f)
{
//**** cannot open
echo "error";
}else{
$cnt = 0;
//**** URL OK
$r = "";
$l = "";
while (substr_count($r,"Content-Length") != 2 && $cnt<10000){
$l.=fread($f,512);
echo $l;
$r.=$l;
$cnt++;
}
$start = strpos($r,'ÿ');
$end = strpos($r,$boundary,$start)-1;
$frame = substr("$r",$start,$end - $start);
echo "FRAME";
//header("Content-type: image/jpeg");
echo $frame;
}
fclose($f);
}
函数mjpeg2jpg_convert(){
$camurl=”http://admin:secretpass@192.168.1.60/Streaming/Channels/1/httppreview”;
$boundary=“\n--”;
$f=fopen($camurl,“r”);
如果(!$f)
{
//****打不开
回声“错误”;
}否则{
$cnt=0;
//****URL OK
$r=“”;
$l=“”;
虽然(substr_count($r,“Content Length”)!=2&&$cntI也有同样的问题,但您找到了解决方案吗?