title: PHP get youtube approxDurationMs with cURL
body: <p>I am trying to get youtube videos approxDurationMs. My code is working but after 2 days stopped work.
  I want only with method cURL because this method is faster. 
  I have a variable with almost 100 URLs.</p>
  
  <pre><code>$vidkey = Mage::getModel('core/variable')-&gt;loadByCode('yvideoDuration')-&gt;getValue('html');
      $forrr = explode("\n",$vidkey);
      $count = count($forrr);
   function curl_get_contents($url)
          {
              $ch = curl_init();
  
              curl_setopt($ch, CURLOPT_HEADER, 0);
              curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
              curl_setopt($ch, CURLOPT_URL, trim($url));
  
              $data = curl_exec($ch);
              curl_close($ch);
  
              return $data;
          }
      for($az = 0; $az &lt; $count; $az++) {
          $new_method = curl_get_contents(''.$forrr[$az]);
          $scrape_ms = explode("approxDurationMs", explode("audioSampleRate", $new_method)[0])[1];
          $strreplace = preg_replace('/[^A-Za-z0-9]/', '', $scrape_ms);
          $mills = $strreplace;
          echo '&lt;span class="sample-video-duration"&gt;'.$mills.'&lt;/span&gt;&lt;br&gt;';
      }
  </code></pre>
  
  <p>Please help.</p>
  
  <p><strong>UPDATE</strong>
  For example: for this URL - <a href="https://www.youtube.com/watch?v=NeQM1c-XCDc" rel="nofollow noreferrer">https://www.youtube.com/watch?v=NeQM1c-XCDc</a>
  Must return: 310868
  And then for each URL.</p>