tags:

views:

7

answers:

1

Currently, I have a function that builds a vimeo player based on a vimeo ID

function create_video_player_by_ID($video_id){
    $player = '<iframe src="http://player.vimeo.com/video/';
    $player .= $video_id.'" ';
    $player .= 'width="'.$this->width.'" ';
    $player .= 'height="'.$this->height.'" ';
    $player .=  'frameborder="0"></iframe>';



    return $player;
}

Currently, I get a vimeo appology in the player window is the ID is invalid, but I would like to do more with that. How can I get a boolean to return before the video player, so I can do something else an failure?

A: 

Try doing a HEAD request on the src URL to make sure it returns status 200 instead of 404.

You can also use the video API to get information about an idea. See their docs.

Anon