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