Skip to content
Advertisement

Is there any way to add a starting of link to a unknown m3u8 file

I recently wrote a code which uses file_get_contents along with some USER_AGENT headers and other headers to get a source of a m3u8 file , when echoed it looks like following

JavaScript

Now I wrote a code to add http://example.com/mono.php? to the url (tracks-v1a1 one ) The code which I wrote is

JavaScript

I tried using preg_replace too but was unsuccessful, can anyone please find out my mistake.

EDITED According to the The Fourth Bird Sir’s link and code The following code worked like a charm

JavaScript

Thanks a lot ‘The Fourth Bird ‘ Sir ,

Advertisement

Answer

You could use

JavaScript

Output

JavaScript

See a php demo

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement