-1

It says theres an error

I'm trying to make it grab between playlist.m3u8?wmsAuthSign= and " on what ever page I put after mylink.com/file.php?f=whatever then the whatever would then be placed after the www.linkhere.com/ in the GETURL code so it grabs between playlist.m3u8?wmsAuthSign= and " on the linkhere.com/whatever page ( if that makes sense

Here is the code:

<?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=", '"');
?>
Sᴀᴍ Onᴇᴌᴀ
  • 8,218
  • 8
  • 36
  • 58
WEB X
  • 21
  • 8

3 Answers3

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

so like this?

WEB X
  • 21
  • 8
0
$url = (!isset($_GET["f"])) ? "filehere.php" : htmlspecialchars($_GET["f"]);
$stream = GetStringBetween(getURL("www.linkhere.com/".$url),"playlist.m3u8?wmsAuthSign=", '"');
  • Parse error: syntax error, unexpected '"),"' (T_CONSTANT_ENCAPSED_STRING) in /home/ygwtljbj/public_html/fs2.php on line 24 which is the $stream – WEB X Jul 22 '16 at 05:42
  • Please edit with more information. Code-only and "try this" answers are discouraged, because they contain no searchable content, and don't explain why someone should "try this". – abarisone Jul 22 '16 at 06:55
0

Don't you think that that it makes much sense to break your codes down in steps & sequences until you can program while sleeping? Besides, breaking your code down into steps helps you see things clearer and learn as well. As one advances, one finds himself even writing a complex algorithm (that would require 30 lines for the apprentice) in one single line... but until then... the apprentice is advised to start from the building blocks, then build up and even do it the complex way (so long as the simple, long, boring way has worked and yield much insight)....

    <?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=', '\"');
    ?>
Poiz
  • 7,611
  • 2
  • 15
  • 17