/** * @return $this * @throws YException */ protected function getFeed() { if (!in_array('curl', get_loaded_extensions())) { throw new YException('CURL is not enabled. See: http://www.php.net/manual/en/curl.setup.php'); } $curl = curl_init(sprintf($this->feedUrl, $this->user->getUser())); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); $this->result = curl_exec($curl); curl_close($curl); return $this; }
/** * Get array of all videos * * @param $user * * @return VideoCollection */ public function getListVideos($user) { $result = null; try { $userYoutube = new User(); $userYoutube->setUser($user); $listener = new Collection($userYoutube); $result = $listener->getVideos(); } catch (YException $e) { echo 'An error has occurred: ' . $e->getMessage(); exit; } return $result; }