Search code examples
zend-frameworkexceptionyoutubegdata

Zend Youtube Api keeps returning exception


Whenever I try to fetch some data from youtube, it keeps returning the "Error writing request to server" as an exception message. I'm using zend 1.12.3 and I tried some of the following, which by the way worked like 1-2 months ago, but now apparently they don't

$yt = new Zend_Gdata_YouTube();
$yt->setMajorProtocolVersion();
$url = 'https://gdata.youtube.com/feeds/api/videos?orderby=relevance&start-index=1&time=this_month&max-results=15&q=pranks+epic+funny+fun+cool';
$videoFeed = $yt->getVideoFeed($url);

or

$yt = new Zend_Gdata_YouTube();
$query = $yt->newVideoQuery();
$query->videoQuery = 'cat';
$query->startIndex = 10;
$query->maxResults = 20;
$query->orderBy = 'viewCount';

$videoFeed = $yt->getVideoFeed($query);

Both of them returning the exception I mentioned. However, this

$yt = new Zend_Gdata_YouTube();
$url = 'http://gdata.youtube.com/feeds/standardfeeds/top_rated?time=today';
$videoFeed = $yt->getVideoFeed($url);

works and doesn't return an error.

I tried the same thing locally and on a server, same error. Is anyone else getting the same error? Is there possibly something wrong with youtube?


Solution

  • For some weird reason, when i changed the $url in the first example from "https://....." to "http://....." it worked.

    This is weird as https is supposed to work, but I leave it here for anyone that might have the same problem.