-1

说有错误

我试图让它在playlist.m3u8?wmsAuthSign="之间抓取我在mylink.com/file.php?f=whatever之后放置的任何页面,然后将放置在www.linkhere.com/之后的任何页面在 GETURL 代码中,因此它在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=", '"');
?>
4

3 回答 3

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=", '"');
?>

像这样?

于 2016-07-22T05:36:10.933 回答
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=', '\"');
    ?>
于 2016-07-22T07:31:39.083 回答
0
$url = (!isset($_GET["f"])) ? "filehere.php" : htmlspecialchars($_GET["f"]);
$stream = GetStringBetween(getURL("www.linkhere.com/".$url),"playlist.m3u8?wmsAuthSign=", '"');
于 2016-07-22T05:30:16.483 回答