title: How to check if stream URL is streaming video
body: <p>I want to know if each url from an m3u file is live streaming video channel or is it dead(No streaming the video).</p>
  <p>streamlist.m3u file:</p>
  <p>`</p>
  <PRE>
  #EXTM3U
  #EXTINF:-1 tvg-logo="https://i.imgur.com/30HzeQe.png" group-title="MOVIES", MOVIES CHANNEL 
  http://tvpremiumhd.club/lista-gratuita/133524/on/live.php?id=livestreamcdn.net:1935/ExtremaTV/ExtremaTV/playlist.m3u8
  #EXTINF:-1 tvg-id="CortTV.mx" tvg-country="MX" tvg-language="Spanish" tvg-logo="https://i.imgur.com/g6ABkaV.png" group-title="Mexico",CorTV (800p)
  http://tvpremiumhd.club/lista-gratuita/133524/on/lives.php?id=stream.oursnetworktv.com/latin/encoder29/playlist.m3u8
  #EXTINF:-1 tvg-id="GenesisTV.mx" tvg-country="MX" tvg-language="Spanish" tvg-logo="https://i.imgur.com/hMtKE60.png" group-title="Mexico",Genesis TV (720p)
  http://tvpremiumhd.club/lista-gratuita/133524/on/live.php?id=201.144.184.98:1935/genesis/smil:television.smil/playlist.m3u8
  #EXTINF:-1 tvg-id="HipodromodelasAmericas.mx" tvg-country="MX" tvg-language="Spanish" tvg-logo="https://www.hipodromo.com.mx/desktop/images/LOGO_HIPODROMO_bco.png" group-title="Mexico",Hipódromo de las Américas (480p)
  http://tvpremiumhd.club/lista-gratuita/133524/on/live.php?id=wms.tecnoxia.com:1935/8158/8158/playlist.m3u8
  </PRE>
  <p>`</p>
  <p>I'm parsing the m3u file to fopen each url but I always get &quot;no stream&quot; .</p>
  <pre><code>&lt;CODE&gt;
  
  $lines = file('streamlist.m3u');
  $results = preg_grep(&quot;/http:/&quot;, $lines);
  $results = array_values($results);
      for($i=0;$i&lt; count($results);$i++) {        
          if(!$fp = @fopen($results[$i])) {
          echo &quot;no stream&lt;/br&gt;&quot;;
              } else {
          echo &quot;streaming is active&quot;;
          fclose($fp);
      }   
  }
  
  &lt;/CODE&gt;
  </code></pre>