I need your help
I want to extract all m3u8 links From Text
$string = "http://exemple.com/file/01.mp4 ,http://exemple.com/file/02.m3u8 , http://exemple.com/file/01.mp3 ,http://exemple.com/file/05.m3u8 ,http://exemple.com/file/02.mp4" ;
Thank you in advance
My Answer:
"Here is an example text containing m3u8 links:
$string = 'Here are some m3u8 links:
https://example.com/video1.m3u8
https://example.com/video2.m3u8
https://example.com/video3.m3u8';
// Use preg_match_all to extract all m3u8 links
preg_match_all('/https?:\/\/[^\s]+\.m3u8/', $string, $matches);
// Print all m3u8 links
foreach ($matches[0] as $link) {
echo $link . "\n";
}"
This code will extract all m3u8 links from the given text and print them out.
Rate this post
3 of 5 based on 2819 votesComments