I
I
ilysion_in_life2018-04-25 12:08:06
PHP
ilysion_in_life, 2018-04-25 12:08:06

Get the content of a string?

Hello, can someone tell me how to get the contents of these lines? prntscr.com/j9un9f
here is the code https://pastebin.com/wQSz4h8u you need to output the content exactly by file and embed

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ice, 2018-04-25
@IceRD

json_decode($file) and then you can refer to the loop as an object

$s = json_decode($file);
  foreach ($s as $t => $k){
    echo $k->comment;
    echo $k->subtitle;
    echo $k->file;
    echo $k->poster;
    echo '<br>';
  }

N
Nick Sdk, 2018-04-25
@lidacriss

<?php
$url = 'https://www.stormo.tv/playlist_iframe/950/';
$content = file_get_contents($url);
$playerjs = [];
if (preg_match_all('/Playerjs\((\{.*?\})\);/isu', $content, $match)) {
    $playerjs = $match[1];
}
echo '<pre>';
if (count($playerjs)) {
    foreach ($playerjs as $item) {
        $file = preg_match("/file:\s*'(.*?)'/isu", $item, $match) ? $match[1] : '';
        $embed = preg_match("/embed:\s*'(.*?)'/isu", $item, $match) ? $match[1] : '';
        print_r($file);
        print_r($embed);
    }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question