public function MediaInternetYouTubeHandler::getOEmbed in Media: YouTube 7
Same name and namespace in other branches
- 7.3 includes/MediaInternetYouTubeHandler.inc \MediaInternetYouTubeHandler::getOEmbed()
- 7.2 includes/MediaInternetYouTubeHandler.inc \MediaInternetYouTubeHandler::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 MediaInternetYouTubeHandler::getOEmbed()
File
- includes/
MediaInternetYouTubeHandler.inc, line 83
Class
- MediaInternetYouTubeHandler
- Implementation of MediaInternetBaseHandler.
Code
public function getOEmbed() {
$uri = $this
->parse($this->embedCode);
$external_url = drupal_realpath($uri);
$oembed_url = url('http://www.youtube.com/oembed', array(
'query' => array(
'url' => $external_url,
'format' => 'json',
),
));
$response = drupal_http_request($oembed_url);
if (!isset($response->error)) {
return drupal_json_decode($response->data);
}
}