Skip to content

Instantly share code, notes, and snippets.

@Rodgath
Last active February 9, 2019 03:42
Show Gist options
  • Save Rodgath/afed82d572f4c22f76c14548ac50b349 to your computer and use it in GitHub Desktop.
Save Rodgath/afed82d572f4c22f76c14548ac50b349 to your computer and use it in GitHub Desktop.
Check if Vimeo video exists or is playable
<?php
/* You can use the HEAD request method using the video URL. */
function check_remote_video_exists($video_url) {
$headers = @get_headers($video_url);
return (strpos($headers[0], '200') > 0) ? true : false;
}
/* Check your vimeo URL like so: */
if (check_remote_video_exists('YOUR_VIMEO_VIDEO_URL')) {
// video exists, do stuff
} else {
// video does not exist, do other stuff
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment