You are here

public function MediaInternetVimeoHandler::getOEmbed in Media: Vimeo 7.2

Same name and namespace in other branches
  1. 7 includes/MediaInternetVimeoHandler.inc \MediaInternetVimeoHandler::getOEmbed()

Returns information about the media.

See http://www.oembed.com.

Return value

If oEmbed information is available, an array containing 'title', 'type', 'url', and other information as specified by the oEmbed standard. Otherwise, NULL.

1 call to MediaInternetVimeoHandler::getOEmbed()
MediaInternetVimeoHandler::getFileObject in includes/MediaInternetVimeoHandler.inc

File

includes/MediaInternetVimeoHandler.inc, line 66
Extends the MediaInternetBaseHandler class to handle Vimeo videos.

Class

MediaInternetVimeoHandler
Implementation of MediaInternetBaseHandler.

Code

public function getOEmbed() {
  $uri = $this
    ->parse($this->embedCode);
  $external_url = file_create_url($uri);
  $oembed_url = url('http://vimeo.com/api/oembed.json', array(
    'query' => array(
      'url' => $external_url,
    ),
  ));
  $response = drupal_http_request($oembed_url);
  if (!isset($response->error)) {
    return drupal_json_decode($response->data);
  }
  else {
    throw new Exception("Error Processing Request. (Error: {$response->code}, {$response->error})");
    return;
  }
}