You are here

function video_filter_oembed_request in Video Filter 6.3

Same name and namespace in other branches
  1. 7.3 video_filter.module \video_filter_oembed_request()

Requests data from an oEmbed provider.

Note: This function currently only supports JSON responses.

@todo Support other response formats than JSON?

Parameters

string $endpoint: The provider endpoint URL.

array $arguments: An associative array of URL arguments to send the provider.

Return value

array|FALSE An array of data if the request is successful, otherwise FALSE.

1 call to video_filter_oembed_request()
video_filter_wistia_html5 in ./video_filter.codecs.inc
Callback for Wistia codec.

File

./video_filter.module, line 634

Code

function video_filter_oembed_request($endpoint, array $arguments) {

  // Make HTTP request.
  $result = drupal_http_request(url($endpoint, array(
    'query' => $arguments,
  )));
  if ($data = json_decode($result->data)) {

    // Success.
    return (array) $data;
  }
  else {

    // Failure. Either the resource doesn't exist or there was an error with the
    // request.
    return FALSE;
  }
}