PHP Stream URL from XML Playlist

Hello everyone,

first of all I want to apologise if I’m posed in wrong place. Now to my concern. I’m not a programmer but have some basic know how from school time when I learned HTML, CSS, JavaScript and so on. I have a problem and after 1 week google research I have come to somewhere but not to a solution. Therefore I hope I’ll get some Help here.
My IPTV Provider hands me the Stream URLs by XML which looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<channels>
<channel>
<title>TV Channel 1</title>
<img>http:/stream.url/channel-logo.png</img>
<info></info>
<url>http:/stream.url/channel.m3u8</url>
</channel>
<channel>
<title>TV Channel 2</title>
<img>http:/stream.url/channel2-logo.png</img>
<info></info>
<url>http:/stream.url/channel2.m3u8</url>
</channel>
...
</channels>

Now I have created my own Playlist .m3u8 with my favorite channels, since there are a lot of them and I don’t want to have all of them. My Provider changes sometimes the stream url so I have allways to replace the URL manualy. Now I thought I could have a PHP stream link like: http://mywebhost.com/myphp?channel=id.

My PHP code for now looks like this: (after 1 week of research, finally the Code gets the content from XML and shows Channel-name and URL)

<?php
$html = "";

$mytv = "http://xml.provider.com/all.php";

$xml=simplexml_load_file($mytv);

for($i = 0; $i < 200; $i++){
	$title = $xml->channel[$i]->title;
	$link = $xml->channel[$i]->url;
	$html .= "<p>$title</p><p>$link</p>";
	}
echo $html;
?> 

Now I want to give each Channel and ID wich can be a 2 Digit number, so that my stream URL would be like this http://mywebhost.com/myphp?channel=id or similar or even better way.
Here ist your help needed, how can I give ID number to all channels, and get the dedicated stream URL as a return for my VLC player in PC and PerfectPlayer in Android device?

In an Android device, specifically? You are constricting to Android specifically from the start. For that it needs to be an app.

To add you id to the link, you just need to append the link you are storing in that format.

Sponsor our Newsletter | Privacy Policy | Terms of Service