
EPG stands for Electronic Program Guide. It is a feature that is available on many TVs and other devices that allows you to view a list of the current and upcoming programs that are available on a particular TV channel or network. The EPG typically includes information such as the name of the program, the time it is scheduled to air, and a brief description of the program. It can be accessed through the TV’s menu or by pressing a dedicated button on the remote control. The EPG can be a useful tool for finding and scheduling your favorite shows and for discovering new programs that you may be interested in.
The script extract the data from the below links:
Country | Channels | EPG |
---|---|---|
68 | https://iptv-org.github.io/epg/guides/af.xml |
|
93 | https://iptv-org.github.io/epg/guides/al.xml |
|
124 | https://iptv-org.github.io/epg/guides/dz.xml |
|
62 | https://iptv-org.github.io/epg/guides/as.xml |
|
83 | https://iptv-org.github.io/epg/guides/ad.xml |
|
118 | https://iptv-org.github.io/epg/guides/ao.xml |
|
63 | https://iptv-org.github.io/epg/guides/ai.xml |
|
51 | https://iptv-org.github.io/epg/guides/aq.xml |
|
63 | https://iptv-org.github.io/epg/guides/ag.xml |
|
273 | https://iptv-org.github.io/epg/guides/ar.xml |
|
99 | https://iptv-org.github.io/epg/guides/am.xml |
|
67 | https://iptv-org.github.io/epg/guides/aw.xml |
|
166 | https://iptv-org.github.io/epg/guides/au.xml |
|
147 | https://iptv-org.github.io/epg/guides/at.xml |
|
98 | https://iptv-org.github.io/epg/guides/az.xml |
|
71 | https://iptv-org.github.io/epg/guides/bs.xml |
|
99 | https://iptv-org.github.io/epg/guides/bh.xml |
|
72 | https://iptv-org.github.io/epg/guides/bd.xml |
|
69 | https://iptv-org.github.io/epg/guides/bb.xml |
|
112 | https://iptv-org.github.io/epg/guides/by.xml |
|
175 | https://iptv-org.github.io/epg/guides/be.xml |
|
87 | https://iptv-org.github.io/epg/guides/bz.xml |
|
112 | https://iptv-org.github.io/epg/guides/bj.xml |
|
57 | https://iptv-org.github.io/epg/guides/bm.xml |
|
69 | https://iptv-org.github.io/epg/guides/bt.xml |
|
206 | https://iptv-org.github.io/epg/guides/bo.xml |
|
55 | https://iptv-org.github.io/epg/guides/bq.xml |
|
122 | https://iptv-org.github.io/epg/guides/ba.xml |
|
102 | https://iptv-org.github.io/epg/guides/bw.xml |
|
53 | https://iptv-org.github.io/epg/guides/bv.xml |
|
304 | https://iptv-org.github.io/epg/guides/br.xml |
|
51 | https://iptv-org.github.io/epg/guides/io.xml |
|
63 | https://iptv-org.github.io/epg/guides/vg.xml |
|
100 | https://iptv-org.github.io/epg/guides/bn.xml |
|
153 | https://iptv-org.github.io/epg/guides/bg.xml |
|
117 | https://iptv-org.github.io/epg/guides/bf.xml |
|
108 | https://iptv-org.github.io/epg/guides/bi.xml |
|
97 | https://iptv-org.github.io/epg/guides/kh.xml |
|
118 | https://iptv-org.github.io/epg/guides/cm.xml |
|
274 | https://iptv-org.github.io/epg/guides/ca.xml |
|
111 | https://iptv-org.github.io/epg/guides/cv.xml |
|
63 | https://iptv-org.github.io/epg/guides/ky.xml |
|
107 | https://iptv-org.github.io/epg/guides/cf.xml |
|
110 | https://iptv-org.github.io/epg/guides/td.xml |
|
235 | https://iptv-org.github.io/epg/guides/cl.xml |
|
182 | https://iptv-org.github.io/epg/guides/cn.xml |
|
51 | https://iptv-org.github.io/epg/guides/cx.xml |
|
51 | https://iptv-org.github.io/epg/guides/cc.xml |
|
226 | https://iptv-org.github.io/epg/guides/co.xml |
|
128 | https://iptv-org.github.io/epg/guides/km.xml |
|
62 | https://iptv-org.github.io/epg/guides/ck.xml |
|
199 | https://iptv-org.github.io/epg/guides/cr.xml |
|
141 | https://iptv-org.github.io/epg/guides/hr.xml |
|
198 | https://iptv-org.github.io/epg/guides/cu.xml |
|
67 | https://iptv-org.github.io/epg/guides/cw.xml |
|
124 | https://iptv-org.github.io/epg/guides/cy.xml |
|
198 | https://iptv-org.github.io/epg/guides/cz.xml |
|
119 | https://iptv-org.github.io/epg/guides/cd.xml |
|
112 | https://iptv-org.github.io/epg/guides/dk.xml |
|
135 | https://iptv-org.github.io/epg/guides/dj.xml |
|
63 | https://iptv-org.github.io/epg/guides/dm.xml |
|
203 | https://iptv-org.github.io/epg/guides/do.xml |
|
101 | https://iptv-org.github.io/epg/guides/tl.xml |
|
201 | https://iptv-org.github.io/epg/guides/ec.xml |
|
164 | https://iptv-org.github.io/epg/guides/eg.xml |
|
202 | https://iptv-org.github.io/epg/guides/sv.xml |
|
122 | https://iptv-org.github.io/epg/guides/gq.xml |
|
100 | https://iptv-org.github.io/epg/guides/er.xml |
|
112 | https://iptv-org.github.io/epg/guides/ee.xml |
|
111 | https://iptv-org.github.io/epg/guides/et.xml |
|
53 | https://iptv-org.github.io/epg/guides/fk.xml |
|
56 | https://iptv-org.github.io/epg/guides/fo.xml |
|
62 | https://iptv-org.github.io/epg/guides/fj.xml |
|
123 | https://iptv-org.github.io/epg/guides/fi.xml |
|
351 | https://iptv-org.github.io/epg/guides/fr.xml |
|
69 | https://iptv-org.github.io/epg/guides/gf.xml |
|
65 | https://iptv-org.github.io/epg/guides/pf.xml |
|
98 | https://iptv-org.github.io/epg/guides/tf.xml |
|
111 | https://iptv-org.github.io/epg/guides/ga.xml |
|
100 | https://iptv-org.github.io/epg/guides/gm.xml |
|
119 | https://iptv-org.github.io/epg/guides/ge.xml |
|
272 | https://iptv-org.github.io/epg/guides/de.xml |
|
110 | https://iptv-org.github.io/epg/guides/gh.xml |
|
51 | https://iptv-org.github.io/epg/guides/gi.xml |
|
159 | https://iptv-org.github.io/epg/guides/gr.xml |
|
60 | https://iptv-org.github.io/epg/guides/gl.xml |
|
63 | https://iptv-org.github.io/epg/guides/gd.xml |
|
80 | https://iptv-org.github.io/epg/guides/gp.xml |
|
69 | https://iptv-org.github.io/epg/guides/gu.xml |
|
201 | https://iptv-org.github.io/epg/guides/gt.xml |
|
53 | https://iptv-org.github.io/epg/guides/gg.xml |
|
113 | https://iptv-org.github.io/epg/guides/gn.xml |
|
107 | https://iptv-org.github.io/epg/guides/gw.xml |
|
53 | https://iptv-org.github.io/epg/guides/gy.xml |
|
91 | https://iptv-org.github.io/epg/guides/ht.xml |
|
51 | https://iptv-org.github.io/epg/guides/hm.xml |
|
204 | https://iptv-org.github.io/epg/guides/hn.xml |
|
152 | https://iptv-org.github.io/epg/guides/hk.xml |
|
203 | https://iptv-org.github.io/epg/guides/hu.xml |
|
102 | https://iptv-org.github.io/epg/guides/is.xml |
|
417 | https://iptv-org.github.io/epg/guides/in.xml |
|
198 | https://iptv-org.github.io/epg/guides/id.xml |
|
88 | https://iptv-org.github.io/epg/guides/ir.xml |
|
102 | https://iptv-org.github.io/epg/guides/iq.xml |
|
150 | https://iptv-org.github.io/epg/guides/ie.xml |
|
51 | https://iptv-org.github.io/epg/guides/im.xml |
|
78 | https://iptv-org.github.io/epg/guides/il.xml |
|
249 | https://iptv-org.github.io/epg/guides/it.xml |
|
119 | https://iptv-org.github.io/epg/guides/ci.xml |
|
65 | https://iptv-org.github.io/epg/guides/jm.xml |
|
186 | https://iptv-org.github.io/epg/guides/jp.xml |
|
52 | https://iptv-org.github.io/epg/guides/je.xml |
|
101 | https://iptv-org.github.io/epg/guides/jo.xml |
|
96 | https://iptv-org.github.io/epg/guides/kz.xml |
|
112 | https://iptv-org.github.io/epg/guides/ke.xml |
|
62 | https://iptv-org.github.io/epg/guides/ki.xml |
|
78 | https://iptv-org.github.io/epg/guides/xk.xml |
|
111 | https://iptv-org.github.io/epg/guides/kw.xml |
|
64 | https://iptv-org.github.io/epg/guides/kg.xml |
|
97 | https://iptv-org.github.io/epg/guides/la.xml |
|
96 | https://iptv-org.github.io/epg/guides/lv.xml |
|
104 | https://iptv-org.github.io/epg/guides/lb.xml |
|
101 | https://iptv-org.github.io/epg/guides/ls.xml |
|
100 | https://iptv-org.github.io/epg/guides/lr.xml |
|
123 | https://iptv-org.github.io/epg/guides/ly.xml |
|
91 | https://iptv-org.github.io/epg/guides/li.xml |
|
111 | https://iptv-org.github.io/epg/guides/lt.xml |
|
103 | https://iptv-org.github.io/epg/guides/lu.xml |
|
57 | https://iptv-org.github.io/epg/guides/mo.xml |
|
116 | https://iptv-org.github.io/epg/guides/mg.xml |
|
103 | https://iptv-org.github.io/epg/guides/mw.xml |
|
164 | https://iptv-org.github.io/epg/guides/my.xml |
|
69 | https://iptv-org.github.io/epg/guides/mv.xml |
|
116 | https://iptv-org.github.io/epg/guides/ml.xml |
|
109 | https://iptv-org.github.io/epg/guides/mt.xml |
|
62 | https://iptv-org.github.io/epg/guides/mh.xml |
|
83 | https://iptv-org.github.io/epg/guides/mq.xml |
|
120 | https://iptv-org.github.io/epg/guides/mr.xml |
|
109 | https://iptv-org.github.io/epg/guides/mu.xml |
|
100 | https://iptv-org.github.io/epg/guides/yt.xml |
|
254 | https://iptv-org.github.io/epg/guides/mx.xml |
|
62 | https://iptv-org.github.io/epg/guides/fm.xml |
|
97 | https://iptv-org.github.io/epg/guides/md.xml |
|
87 | https://iptv-org.github.io/epg/guides/mc.xml |
|
60 | https://iptv-org.github.io/epg/guides/mn.xml |
|
99 | https://iptv-org.github.io/epg/guides/me.xml |
|
63 | https://iptv-org.github.io/epg/guides/ms.xml |
|
124 | https://iptv-org.github.io/epg/guides/ma.xml |
|
118 | https://iptv-org.github.io/epg/guides/mz.xml |
|
97 | https://iptv-org.github.io/epg/guides/mm.xml |
|
102 | https://iptv-org.github.io/epg/guides/na.xml |
|
62 | https://iptv-org.github.io/epg/guides/nr.xml |
|
72 | https://iptv-org.github.io/epg/guides/np.xml |
|
256 | https://iptv-org.github.io/epg/guides/nl.xml |
|
63 | https://iptv-org.github.io/epg/guides/nc.xml |
|
145 | https://iptv-org.github.io/epg/guides/nz.xml |
|
194 | https://iptv-org.github.io/epg/guides/ni.xml |
|
110 | https://iptv-org.github.io/epg/guides/ne.xml |
|
134 | https://iptv-org.github.io/epg/guides/ng.xml |
|
62 | https://iptv-org.github.io/epg/guides/nu.xml |
|
62 | https://iptv-org.github.io/epg/guides/nf.xml |
|
60 | https://iptv-org.github.io/epg/guides/kp.xml |
|
104 | https://iptv-org.github.io/epg/guides/mk.xml |
|
62 | https://iptv-org.github.io/epg/guides/mp.xml |
|
114 | https://iptv-org.github.io/epg/guides/no.xml |
|
98 | https://iptv-org.github.io/epg/guides/om.xml |
|
72 | https://iptv-org.github.io/epg/guides/pk.xml |
|
62 | https://iptv-org.github.io/epg/guides/pw.xml |
|
99 | https://iptv-org.github.io/epg/guides/ps.xml |
|
197 | https://iptv-org.github.io/epg/guides/pa.xml |
|
62 | https://iptv-org.github.io/epg/guides/pg.xml |
|
213 | https://iptv-org.github.io/epg/guides/py.xml |
|
228 | https://iptv-org.github.io/epg/guides/pe.xml |
|
154 | https://iptv-org.github.io/epg/guides/ph.xml |
|
62 | https://iptv-org.github.io/epg/guides/pn.xml |
|
263 | https://iptv-org.github.io/epg/guides/pl.xml |
|
174 | https://iptv-org.github.io/epg/guides/pt.xml |
|
191 | https://iptv-org.github.io/epg/guides/pr.xml |
|
143 | https://iptv-org.github.io/epg/guides/qa.xml |
|
114 | https://iptv-org.github.io/epg/guides/cg.xml |
|
199 | https://iptv-org.github.io/epg/guides/ro.xml |
|
272 | https://iptv-org.github.io/epg/guides/ru.xml |
|
118 | https://iptv-org.github.io/epg/guides/rw.xml |
|
101 | https://iptv-org.github.io/epg/guides/re.xml |
|
77 | https://iptv-org.github.io/epg/guides/bl.xml |
|
94 | https://iptv-org.github.io/epg/guides/sh.xml |
|
63 | https://iptv-org.github.io/epg/guides/kn.xml |
|
63 | https://iptv-org.github.io/epg/guides/lc.xml |
|
77 | https://iptv-org.github.io/epg/guides/mf.xml |
|
60 | https://iptv-org.github.io/epg/guides/pm.xml |
|
63 | https://iptv-org.github.io/epg/guides/vc.xml |
|
62 | https://iptv-org.github.io/epg/guides/ws.xml |
|
84 | https://iptv-org.github.io/epg/guides/sm.xml |
|
117 | https://iptv-org.github.io/epg/guides/sa.xml |
|
120 | https://iptv-org.github.io/epg/guides/sn.xml |
|
305 | https://iptv-org.github.io/epg/guides/rs.xml |
|
107 | https://iptv-org.github.io/epg/guides/sc.xml |
|
101 | https://iptv-org.github.io/epg/guides/sl.xml |
|
145 | https://iptv-org.github.io/epg/guides/sg.xml |
|
71 | https://iptv-org.github.io/epg/guides/sx.xml |
|
170 | https://iptv-org.github.io/epg/guides/sk.xml |
|
153 | https://iptv-org.github.io/epg/guides/si.xml |
|
62 | https://iptv-org.github.io/epg/guides/sb.xml |
|
121 | https://iptv-org.github.io/epg/guides/so.xml |
|
202 | https://iptv-org.github.io/epg/guides/za.xml |
|
53 | https://iptv-org.github.io/epg/guides/gs.xml |
|
189 | https://iptv-org.github.io/epg/guides/kr.xml |
|
101 | https://iptv-org.github.io/epg/guides/ss.xml |
|
245 | https://iptv-org.github.io/epg/guides/es.xml |
|
69 | https://iptv-org.github.io/epg/guides/lk.xml |
|
128 | https://iptv-org.github.io/epg/guides/sd.xml |
|
57 | https://iptv-org.github.io/epg/guides/sr.xml |
|
51 | https://iptv-org.github.io/epg/guides/sj.xml |
|
100 | https://iptv-org.github.io/epg/guides/sz.xml |
|
176 | https://iptv-org.github.io/epg/guides/se.xml |
|
225 | https://iptv-org.github.io/epg/guides/ch.xml |
|
100 | https://iptv-org.github.io/epg/guides/sy.xml |
|
107 | https://iptv-org.github.io/epg/guides/st.xml |
|
67 | https://iptv-org.github.io/epg/guides/tw.xml |
|
63 | https://iptv-org.github.io/epg/guides/tj.xml |
|
109 | https://iptv-org.github.io/epg/guides/tz.xml |
|
151 | https://iptv-org.github.io/epg/guides/th.xml |
|
111 | https://iptv-org.github.io/epg/guides/tg.xml |
|
62 | https://iptv-org.github.io/epg/guides/tk.xml |
|
62 | https://iptv-org.github.io/epg/guides/to.xml |
|
63 | https://iptv-org.github.io/epg/guides/tt.xml |
|
125 | https://iptv-org.github.io/epg/guides/tn.xml |
|
253 | https://iptv-org.github.io/epg/guides/tr.xml |
|
59 | https://iptv-org.github.io/epg/guides/tm.xml |
|
63 | https://iptv-org.github.io/epg/guides/tc.xml |
|
62 | https://iptv-org.github.io/epg/guides/tv.xml |
|
51 | https://iptv-org.github.io/epg/guides/um.xml |
|
63 | https://iptv-org.github.io/epg/guides/vi.xml |
|
110 | https://iptv-org.github.io/epg/guides/ug.xml |
|
83 | https://iptv-org.github.io/epg/guides/ua.xml |
|
133 | https://iptv-org.github.io/epg/guides/ae.xml |
|
411 | https://iptv-org.github.io/epg/guides/uk.xml |
|
1380 | https://iptv-org.github.io/epg/guides/us.xml |
|
220 | https://iptv-org.github.io/epg/guides/uy.xml |
|
63 | https://iptv-org.github.io/epg/guides/uz.xml |
|
63 | https://iptv-org.github.io/epg/guides/vu.xml |
|
84 | https://iptv-org.github.io/epg/guides/va.xml |
|
209 | https://iptv-org.github.io/epg/guides/ve.xml |
|
99 | https://iptv-org.github.io/epg/guides/vn.xml |
|
63 | https://iptv-org.github.io/epg/guides/wf.xml |
|
108 | https://iptv-org.github.io/epg/guides/eh.xml |
|
98 | https://iptv-org.github.io/epg/guides/ye.xml |
|
109 | https://iptv-org.github.io/epg/guides/zm.xml |
|
102 | https://iptv-org.github.io/epg/guides/zw.xml |
|
58 | https://iptv-org.github.io/epg/guides/ax.xml |
- The first thing the script does is set the default timezone to UTC using the
date_default_timezone_set()
function. This ensures that the current date and time is retrieved in the UTC timezone. - The script then retrieves the current date and time in the format “YYYYMMDDHHmm” using the
date()
function, and stores it in the variable$now
. This value will be used later to check if a program is currently airing or starts later today. - Next, the script checks if the GET request has been made using the
isset()
function and the$_GET
array. If the GET request has been made, the script extracts thechannelId
parameter from the$_GET
array and stores it in the variable$channelId
. - The script then creates a new
XMLReader
object and opens the XML file at the specified URL using theopen()
method. - The script enters a loop that reads the XML file incrementally using the
read()
method of theXMLReader
object. At each iteration, the script checks the type and name of the current node using thenodeType
andname
properties of theXMLReader
object. - If the current node is a “channel” element, the script loads the element into a
SimpleXMLElement
object using thereadOuterXML()
method of theXMLReader
object, and extracts theid
attribute of the element. If theid
attribute matches thechannelId
parameter passed in the GET request, the script extracts thedisplay-name
,icon
, andurl
elements of thechannel
element, and stores them in the variables$displayName
,$iconUrl
, and$url
, respectively. It then checks if these variables are set, and if they are, it prints the channel information to the webpage. - If the current node is a “programme” element, the script loads the element into a
SimpleXMLElement
object using thereadOuterXML()
method of theXMLReader
object, and extracts thestart
andstop
attributes of the element. It then converts these attributes to the desired format using thestrtotime()
anddate()
functions, and stores the result in the variables$formattedStartTime
and$formattedStopTime
. The script also extracts thechannel
attribute of theprogramme
element, and stores it in the variable$programChannelId
. - If the
$programChannelId
variable matches thechannelId
parameter passed in the GET request, the script checks if the program is currently airing or starts later today by comparing the$startTime
and$stopTime
variables to the$now
variable. If the program is currently airing or starts later today, the script extracts thetitle
,desc
,category
, andicon
elements of theprogramme
element, and stores them in the variables$title
,$description
,$category
, andiconUrl
, respectively. It then prints the program information to the webpage. - After the loop has finished executing, the script closes the XML file using the
close()
method of theXMLReader
object.
To use this script, you would need to send a GET request to the script with the desired channel ID passed as a parameter. For example, if you wanted to get information about the channel with the ID “12345”, you would send a GET request to “localhost/epg.php?channelId=NameOfTheChannelID”.
The channelID shoud be the same as in the XML.
When the script receives the GET request, it will retrieve the XML file, parse it incrementally using an XMLReader object, and extract the information about the desired channel and its current program. It will then print this information to the webpage.
If the GET request is not made or if the specified channel ID is not found in the XML file, the script will not output any information.
EX:
Full script:
<?php
// Set the timezone to the desired timezone
date_default_timezone_set('UTC');
// Get the current date and time in the desired format
$now = date('YmdHi');
// Check if the GET request has been made
if (isset($_GET['channelId'])) {
// Get the channel ID from the GET request
$channelId = $_GET['channelId'];
// Create a new XMLReader object
$reader = new XMLReader();
// Open the XML file
$reader->open('https://iptv-org.github.io/epg/guides/pl.xml');
// Read the file incrementally
while ($reader->read()) {
// If the current node is a "channel" element
if ($reader->nodeType == XMLReader::ELEMENT && $reader->name == 'channel') {
// Load the "channel" element into a SimpleXMLElement object
$channel = new SimpleXMLElement($reader->readOuterXML());
// Extract the channel ID
$currentChannelId = (string)$channel['id'];
// If the channel ID matches the one from the GET request
if ($currentChannelId == $channelId) {
// Extract the information you need from the "channel" element
$displayName = (string)$channel->{'display-name'};
$iconUrl = (string)$channel->icon['src'];
$url = (string)$channel->url;
// Print the channel information
// Check if the variables are set
if (isset($channelId) && isset($displayName) && isset($iconUrl)) {
// Print the channel information
echo "<h1>Channel ID: $channelId</h1>";
echo "<p>Display name: $displayName</p>";
echo "<img src='$iconUrl'>";
}
}
}
// If the current node is a "programme" element
if ($reader->nodeType == XMLReader::ELEMENT && $reader->name == 'programme') {
// Load the "programme" element into a SimpleXMLElement object
$program = new SimpleXMLElement($reader->readOuterXML());
// Extract the start and stop time of the program
// Extract the start and stop time of the program
$startTime = (string)$program['start'];
$stopTime = (string)$program['stop'];
// Convert the start and stop time to the desired format
$formattedStartTime = date('H:i - d.m.Y', strtotime($startTime));
$formattedStopTime = date('H:i - d.m.Y', strtotime($stopTime));
// Extract the channel ID of the program
$programChannelId = (string)$program['channel'];
// If the channel ID of the program matches the one from the GET request
if ($programChannelId == $channelId) {
// Check if the program is currently airing or starts later today
if ($startTime <= $now && $now <= $stopTime || $startTime >= $now) {
// Extract the information you need from the "programme" element
$title = (string)$program->title;
$description = (string)$program->desc;
$category = (string)$program->category;
$iconUrl = (string)$program->icon['src'];
// Print the program information
echo "<h2>Title: $title</h2>";
echo "<img src='$iconUrl'>";
echo "<p>Description: $description</p>";
echo "<p>Category: $category</p>";
echo "<p>Start time: $formattedStartTime</p>";
echo "<p>Stop time: $formattedStopTime</p>";
}
}
}
}
// Close the XML file
$reader->close();
}
?>
Was this helpful?
1 / 0