function emfield_request_header in Embedded Media Field 6.3
Same name and namespace in other branches
- 5 emfield.module \emfield_request_header()
- 6 emfield.module \emfield_request_header()
- 6.2 emfield.module \emfield_request_header()
Get the HTTP Header of media, for mime-type and length.
Parameters
$provider: The string of the third party provider, such as 'youtube' or 'flickr'. @param $url The url for the media. @param $cached (Optional) If TRUE, the result of this xml request will be cached. good to play nice with the third party folks so they don't stop providing service to your site... @return The header results, returned as an array.
4 calls to emfield_request_header()
- emaudio_custom_url_data in contrib/
emaudio/ providers/ custom_url.inc - emvideo_google_data in contrib/
emvideo/ providers/ google.inc - hook emfield_PROVIDER_data
- emvideo_twistage_data in contrib/
emvideo/ providers/ twistage.inc - Implementation of hook_PROVIDER_data().
- emvideo_zzz_custom_url_data in contrib/
emvideo/ providers/ zzz_custom_url.inc
File
- deprecated/
emfield-deprecated.inc, line 439 - Functionality to be deprecated from earlier versions of Embedded Media Field.
Code
function emfield_request_header($provider, $url, $cached = TRUE, $return_errors = TRUE) {
// if it's cacheable, try to load a cached value
if ($cached && ($cache = cache_get('emfield:request-header:' . $url, 'cache_emfield_xml'))) {
return $cache->data;
}
$result = _emfield_http_request_header($url);
if (!empty($result->error)) {
if ($return_errors) {
return $result;
}
emfield_set_error(t("Could not connect to @provider: HTTP error @error.", array(
'@error' => $result->code,
'@provider' => $provider,
)));
return array();
}
// Cache the result.
cache_set('emfield:request-header:' . $url, $result, 'cache_emfield_xml', time() + variable_get('emfield_cache_duration', 3600));
return $result;
}