title: Easy way to get Vimeo id from a vimeo url
body: <p>I'm trying to get just the id from a vimeo URL. Is there a simpler way than this? All the vimeo video urls I see are always:</p>
  
  <p><a href="https://vimeo.com/29474908" rel="noreferrer">https://vimeo.com/29474908</a></p>
  
  <p><a href="https://vimeo.com/38648446" rel="noreferrer">https://vimeo.com/38648446</a></p>
  
  <pre><code>// VIMEO
  
  
  $vimeo = $_POST['vimeo'];
  
  function getVimeoInfo($vimeo)
  {
      $url = parse_url($vimeo);
      if($url['host'] !== 'vimeo.com' &amp;&amp;
              $url['host'] !== 'www.vimeo.com')
          return false;
     if (preg_match('~^http://(?:www\.)?vimeo\.com/(?:clip:)?(\d+)~', $vimeo, $match)) 
     {
         $id = $match[1];
     }
     else
     {
         $id = substr($link,10,strlen($link));
     }
  
     if (!function_exists('curl_init')) die('CURL is not installed!');
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, "http://vimeo.com/api/v2/video/$id.php");
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_TIMEOUT, 10);
     $output = unserialize(curl_exec($ch));
     $output = $output[0];
     curl_close($ch);
     return $output['id'];
  }
  
  $vimeo_id = getVimeoInfo($vimeo);
  </code></pre>