请教php一个问题,同时附上一个直播源的代理源码福利
php文件来与天天在线分享的问题是打开这个php时,浏览器提示“Fatal error: Call to undefined function userip() in /home/wwwroot/default/tv.php on line 144”
有哪位大佬知道该怎么操作的?
[*]= count($CODE_MAP)){
[*] $bIndex = $bIndex - count($CODE_MAP);
[*] }
[*] $accountStr .= $CODE_ARRAY[$bIndex];
[*] } else {
[*] $accountStr .= $a;
[*] }
[*] }
[*] $softwareVersion = substr($accountStr, strrpos($accountStr, "@") + 1);
[*] $accountStr = substr($accountStr, 0, strrpos($accountStr, "@"));
[*] $softwareCode = substr($accountStr, strrpos($accountStr, "@") + 1);
[*] $accountStr = substr($accountStr, 0, strrpos($accountStr, "@"));
[*] $resp['client_ip'] =$clientIp;
[*] $resp['version'] =$version_tm;
[*] $resp['account'] =$accountStr;
[*] $resp['software_code'] =$softwareCode;
[*] $resp['software_version'] =$softwareVersion;
[*] $resp['token'] =$acc_token;
[*] return $resp;
[*]}
[*]
[*]function getNToken($clientIp = "127.0.0.1", $account = "132020005012", $softwareCode = "SUNTV", $softwareVersion = "0.4.89", $prefix = "O"){
[*] $ipbuf = array();
[*] $CODE_MAP = array();
[*] $acinfo = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,1,2,3,4,5,6,7,8,9,0,-,_,@,.";
[*] $CODE_ARRAY = explode(",", $acinfo);
[*] for($i=0;$istrlen($suffix)){
[*] $cLength = $accountLength - strlen($suffix);
[*] $suffix = getRandomString($cLength) . $suffix;
[*] }
[*] $tokenbuf = "";
[*] if($accountLength = $keyValue){
[*] $bIndex = $aIndex - $keyValue;
[*] } else {
[*] $bIndex = count($CODE_ARRAY) + $aIndex - $keyValue;
[*] }
[*] $tokenbuf .= $CODE_ARRAY[$bIndex];
[*] } else {
[*] $tokenbuf .= $a;
[*] }
[*] }
[*] $tokenbuf .= $suffix;
[*] return base64UrlEncode($tokenbuf);
[*]}
[*]
[*]$uidlist = ["142029001763","142029001915","142029001916","142029001976"];
[*]$rand_keys = array_rand($uidlist);
[*]$access_token = getNToken(userip(), $uidlist[$rand_keys]);
[*]$stype = empty($_GET['type']) ? "ipsd" : trim($_GET['type']);
[*]$channel = empty($_GET['channel']) ? "CCTV1HD" : trim($_GET['channel']);
[*]$strUrl = sprintf("http://stream.suntv.tvmining.com/approve/live?channel=%s&type=%s&access_token=%s", $channel, $stype, $access_token);
[*]echo $strUrl;
[*]复制代码 144行的 userip() 方法不存在。 getNToken
xiaoxiaobai 发表于 2019-4-11 21:55
144行的 userip() 方法不存在。
嗯,知道是userip() 的问题,但不知道怎么弄 加在最后面 function userip(){
if(getenv('HTTP_CLIENT_IP') && strcasecmp(getenv('HTTP_CLIENT_IP'), 'unknown')) {
$ip = getenv('HTTP_CLIENT_IP');
} elseif(getenv('HTTP_X_FORWARDED_FOR') && strcasecmp(getenv('HTTP_X_FORWARDED_FOR'), 'unknown')) {
$ip = getenv('HTTP_X_FORWARDED_FOR');
} elseif(getenv('REMOTE_ADDR') && strcasecmp(getenv('REMOTE_ADDR'), 'unknown')) {
$ip = getenv('REMOTE_ADDR');
} elseif(isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], 'unknown')) {
$ip = $_SERVER['REMOTE_ADDR'];
}
$res =preg_match ( '/[\d\.]{7,15}/', $ip, $matches ) ? $matches : '';
return $res;
}
后悔当初不努力 发表于 2019-4-11 22:09
加在最后面 function userip(){
if(getenv('HTTP_CLIENT_IP') && strcasecmp(getenv('HTTP_CLIENT_IP'), ' ...
谢谢回复,不报错了。不过不知道是原php的问题还是其他问题,解析出来的地址还是不能播放
页:
[1]