它说是错误
我试图让它在 playlist.m3u8?wmsAuthSign = 和" 之间抓住我在 mylink之后放置的任何页面.com / file.php?f =无论什么然后然后将放在GETURL代码中的 www.linkhere.com / 之后,这样它就抓住了在 linkhere.com/whatever 页面上的 playlist.m3u8?wmsAuthSign = 和" 之间(如果这是有意义的
以下是代码:
<?php
function getURL($u){
$u = file_get_contents("http://{$u}");
return $u != false ? $u : "";
}
function GetStringBetween($string, $start, $finish){
$string = " ".$string;
$position = strpos($string, $start);
if ($position == 0) return "";
$position += strlen($start);
$length = strpos($string, $finish, $position) - $position;
return substr($string, $position, $length);
}
$stream = GetStringBetween(getURL("www.linkhere.com/<?=!isset($_GET["f"]) ? "filehere.php" : htmlspecialchars($_GET["f"])?>"),"playlist.m3u8?wmsAuthSign=", '"');
?>
答案 0 :(得分:1)
<?php
function getURL($u){
$u = file_get_contents("http://{$u}");
return $u != false ? $u : "";
}
function GetStringBetween($string, $start, $finish){
$string = " ".$string;
$position = strpos($string, $start);
if ($position == 0) return "";
$position += strlen($start);
$length = strpos($string, $finish, $position) - $position;
return substr($string, $position, $length);
}
$url = (!isset($_GET["f"])) ? "filehere.php" : htmlspecialchars($_GET["f"]);
$stream = GetStringBetween(getURL("www.linkhere.com/".$url),"playlist.m3u8?wmsAuthSign=", '"');
?>
这样吗?
答案 1 :(得分:0)
$url = (!isset($_GET["f"])) ? "filehere.php" : htmlspecialchars($_GET["f"]);
$stream = GetStringBetween(getURL("www.linkhere.com/".$url),"playlist.m3u8?wmsAuthSign=", '"');
答案 2 :(得分:0)
不要认为按顺序分解代码是非常有意义的。序列直到你可以在睡觉时编程?此外,将代码分解为步骤可以帮助您更清楚地了解事物并进行学习。随着一个人的进步,人们发现自己甚至在一行中编写了一个复杂的算法(学徒需要30行)...但在那之前......建议学徒从构建块开始,然后建立和甚至以复杂的方式做到这一点(只要简单,漫长,无聊的方式起作用并产生很多洞察力)....
<?php
function getURL($u){
$u = file_get_contents("http://{$u}");
return ($u != false) ? $u : "";
}
function GetStringBetween($string, $start, $finish){
$string = " ".$string;
$position = strpos($string, $start);
if ($position == 0){ return "";}
$position += strlen($start);
$length = strpos($string, $finish, $position) - $position;
return substr($string, $position, $length);
}
$f = ( !isset($_GET["f"]) ) ? "filehere.php" : htmlspecialchars(trim($_GET["f"]);
$url = "www.linkhere.com/{$f}";
$theURI = getURL($url);
$stream = GetStringBetween($theURI,'playlist.m3u8?wmsAuthSign=', '\"');
?>