简体   繁体   中英

PHP get value with file_get_content()

i want to get of " file " m3u8 from this page " view-source: http://www.freelivestream.tv/embedPlayer.php?file=cartoon "

i'm trying this code but not getting all value it give , any help please

    <?php

$url = "http://www.freelivestream.tv/embedPlayer.php?file=cartoon";
$contents = file_get_contents($url);

preg_match('@m3u8([^"]+)@',$contents,$filo);
$filo = urldecode($filo[0]);



echo $filo;


?> 

i'm want to get like this : http://95.141.32.136:8081/edge/cartoon/playlist.m3u8?wmsAuthSign=c2VydmVyX3RpbWU9OS8xOS8yMDE3IDEyOjE4OjEyIFBNJmhhc2hfdmFsdWU9aGI4bVZBZEdKY3E3ZVpFOWx3REdadz09JnZhbGlkbWludXRlcz01

but with my code it give only : m3u8?wmsAuthSign=c2VydmVyX3RpbWU9OS8xOS8yMDE3IDEyOjE4OjEyIFBNJmhhc2hfdmFsdWU9aGI4bVZBZEdKY3E3ZVpFOWx3REdadz09JnZhbGlkbWludXRlcz01

thanks

Use below code:

$url = "http://www.freelivestream.tv/embedPlayer.php?file=cartoon";
$contents = file_get_contents($url);

preg_match('/"(.*)m3u8(.*)"/',$contents,$filo);
$filo = urldecode($filo[0]);

echo $filo;

Hope this will help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM