You are here

function _video_embed_field_get_vimeo_data in Video Embed Field 7.2

Helper function to get the Vimeo video's data attributes.

Parameters

string $url: A Vimeo video URL to get the data from.

Return value

integer|false The video's data attributes, or FALSE if unable to get the video ID.

2 calls to _video_embed_field_get_vimeo_data()
video_embed_field_handle_vimeo in ./video_embed_field.handlers.inc
Handler for Vimeo videos.
video_embed_field_handle_vimeo_thumbnail in ./video_embed_field.handlers.inc
Gets the thumbnail url for vimeo videos.
1 string reference to '_video_embed_field_get_vimeo_data'
video_embed_field_video_embed_handler_info in ./video_embed_field.handlers.inc
Implements hook_video_embed_handler_info().

File

./video_embed_field.handlers.inc, line 456
Provide some handlers for video embed field Other modules can implement the hook_video_embed_handler_info to provide more handlers.

Code

function _video_embed_field_get_vimeo_data($url) {

  // Set oembed endpoint
  $oembed_endpoint = 'http://vimeo.com/api/oembed';

  // Fetch vimeo data
  $response = drupal_http_request($oembed_endpoint . '.json?url=' . rawurlencode($url));
  try {
    return json_decode($response->data, TRUE);
  } catch (Exception $e) {
    return FALSE;
  }
}