Hello,
I ran into the following problem after upgrading to this version of media:youtube. I still can add videos from other providers (vimeo etc.)
- Warning: get_headers() [function.get-headers]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in MediaInternetYouTubeHandler->valid_id() (line 27 of /XXX/D7/sites/all/modules/media_youtube/includes/MediaInternetYouTubeHandler.inc).
- Warning: get_headers() [function.get-headers]: This function may only be used against URLs in MediaInternetYouTubeHandler->valid_id() (line 27 of /XXX/D7/sites/all/modules/media_youtube/includes/MediaInternetYouTubeHandler.inc).
- The YouTube video ID is invalid or the video was deleted.
I tried it with several videos which surely are not deleted! And I defined allow_url_fopen = On in a custom php.ini
Would it solve to problem to returning to a previous version of this module? About any help in regards to this I would be really glad!
SDK
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | media_youtube-get-headers-fails-1446944-5.patch | 721 bytes | defiantbyte |
| #3 | media-youtube-get-headers-fails-1446944-0.patch | 1.15 KB | defiantbyte |
| Screen shot 2012-02-20 at 4.23.45 PM.png | 64.85 KB | sdk |
Comments
Comment #1
sdk commentedI switched back to the alpha5 version and it is working. I assume this is still an issue with the beta1 version though....
Comment #2
ckopack commentedThat did it for me too. Just FYI I am using Media 2.x unstable, Media gallery 1.x 7beta, media browser plus 7.x 1beta3. I had a bunch of problems today all related to the embedded media. The alpha seems to work fine.
Thanks sdk BTW
Comment #3
defiantbyte commentedI had the same issue when I moved a site to production. I've attached a patch that uses cURL as a fallback option for when get_headers fails.
Comment #4
triple5 commentedCan you tell us please if this fix is also included in 7.x-1.0-beta2 ?
Comment #5
DJ C commentedhere is a fast fix for the
'get_headers not supported by all php implementations'
problem:
MediaInternetYouTubeHandler.inc
public function valid_id($id) {
$url = 'http://gdata.youtube.com/feeds/api/videos/'. $id;
$response = drupal_http_request($url);
$valid = ($response->code == 200);
// $headers = get_headers($url);
// $valid = strpos($headers[0], '200') !== FALSE;
if (!$valid) {
throw new MediaInternetValidationException(t('The YouTube video ID is invalid or the video was deleted.'));
}
return $valid;
}
Comment #6
defiantbyte commented#4 (triple5) I don't think this patch has been included in beta1
#5 (DJ C) This looks like a cleaner fix than what I originally posted. Would you mind attaching a patch with it?
Comment #7
defiantbyte commentedPut DJ C's suggestion into the patch as opposed to the cURL fallback. Patch now uses drupal_http_request.
Comment #8
dave reidThis was fixed with #1480556: Use drupal_http_request() instead of get_headers() in MeidaInternetYouTubeHandler::valid_id(), sorry I didn't see that it was a duplicate of this issue first.
Comment #9
littlemisssunshine commentedI'm using the latest dev version and I'm still seeing this error.
Comment #11
mbruneel commentedAre you behind a proxy? media_youtube uses drupal_http_request() to check if video is valid. Have a look at proxy section in your settings.php file.