PHP模拟登陆AUTH验证设置路由DMZ映射
No Proxy-Authorization Header is present.
Authorization Header is present: Basic YWRtaW46cGFzc3dvcmQ=
Decoded Username:Password= admin:admin
<?php
$ch = curl_init();
$url = 'http://192.168.0.1/goform/RgDmzHost';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1); //让cURL支持页面跳转
//https请求必须设置以下两项
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_HEADER,0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
//curl_setopt($ch, CURLOPT_COOKIESESSION,TRUE); //使用COOKIES开启//设置凭证
$post = 'DmzHostIP3=253';
curl_setopt($ch,CURLOPT_POST,1);//使用post提交数据
curl_setopt($ch,CURLOPT_POSTFIELDS,$post);//设置 post提交的数据
curl_setopt($ch, CURLOPT_USERPWD, 'admin:pass'); //设置用户密码
//执行请求
$output = curl_exec($ch);
curl_close($ch);function strbetweenAB($srcstr,$stra,$strb){
$i=strrpos($srcstr,$stra);
$j=strrpos($srcstr,$strb);
$b=substr($srcstr,$i+strlen($stra),$j-$i-strlen($stra));
return $b;
}
$stra="<b>192.168.0.</b><input name=DmzHostIP3 size=3 maxlength=3 value=";
$strb=">";
$str=strbetweenAB($output,$stra,$strb);
echo $str;
?>
转载请注明:RAIN MAN » PHP模拟登陆AUTH验证设置路由DMZ映射
还没有人抢沙发呢~