parse xml sub-title php

Viewed 15

I am trying to parse xml link to get the sub-title information,but I haven't results. Can someone help me?

 <?php
     $time = date( "YmdHi" );
     $url = 'https://hls.airy.tv/airytv/33';
     if(!$xml = simplexml_load_file("$url")){
        } else {
        foreach($xml->xpath('programme[@channel="33"]') as $item) {
            $start = substr( (string)$item["start"], 0, -8);
            $end   = substr( (string)$item["stop"], 0, -8);
            if ($time > $start && $time < $end) {
                echo $item->title."<br>";
                echo $item->sub-title;
            }
        }
     }
 ?>

XML link look like that

<programme start="20220907131816 +0000" stop="20220907142334 +0000" channel="33">
    <title lang="en">Hockey Night in Thailand Rewind DEC 12 2019_Game_1 Ep 013</title>
    <sub-title lang="en">Hockey Night in Thailand Rewind DEC 12 2019_Game_1 Ep 013</sub-title>
    <desc lang="en">Encore Presentation of the Siam Hockey League (SHL) from Bangkok 
    Thailand</desc>
    <date>20220907</date>
    <publisher/>
    <category lang="en">Featured</category>
    <category lang="en">Airy TV 1</category>
</programme>
0 Answers
Related