i need take XML data from this URL : http://45.119.203.114:8888/xmltv.php?username=epg&password=epg to parse EPG data
i have try with Javascript And PHP but it doesn't work
this my code
Javascript
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", 'http://45.119.203.114:8888/xmltv.php?username=epg&password=epg'); // false for synchronous request
xmlHttp.responseType = 'document';
xmlHttp.setRequestHeader('Accept', 'application/xml');
xmlHttp.onload = function () {
if ( xmlHttp.readyState == 4 && xmlHttp.status == 200 ) {
console.log(xmlHttp.responseXML);
}
}
xmlHttp.send();
the result in my javascript code is always No 'Access-Control-Allow-Origin'
and this my PHP code
$path = 'http://tvku.live:8888/xmltv.php?username=epg&password=epg';
$xml=simplexml_load_file($path);
$me = "sub-title";
foreach($xml->programme as $item){
echo "Start : " .date("G:i d.m.Y", strtotime(substr($item["start"], 0, -6))) . '<br>';
echo "End : " .date("G:i d.m.Y", strtotime(substr($item["stop"], 0, -6))) . '<br>';
echo "Channel : ".$item["channel"]. "<br>";
echo "Title : ".$item->title. "<br>";
echo "Info : ".$item->$me. "<br>";
echo "Description : ".$item->desc. "<br>";
echo "<br>";
}
there is no result in my php code, before in my PHP code i have try using CURL to get data but not that works too
please ask for your help, thanks