php - get vimeo video id from url
function getVimeoVideoIdFromUrl($url = '') {
$regs = array();
$id = '';
if (preg_match('%^https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\#?)(?:[?]?.*)$%im', $url, $regs)) {
$id = $regs[3];
}
// else
// {
// $id = substr($url,10,strlen($url));
// }
return $id;
}
Comments
Post a Comment