function video_filter_oembed_request in Video Filter 7.3
Same name and namespace in other branches
- 6.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.
4 calls to video_filter_oembed_request()
- video_filter_instagram in ./
video_filter.codecs.inc - Callback for Instagram codec.
- video_filter_rutube in ./
video_filter.codecs.inc - Callback for Rutube codec.
- video_filter_soundcloud in ./
video_filter.codecs.inc - Callback for Soundcloud codec.
- video_filter_wistia_html5 in ./
video_filter.codecs.inc - Callback for Wistia codec.
File
- ./
video_filter.module, line 797
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;
}
}