public function GetTrack() { $output = array(); $content = curlClass::getInstance()->fetchURL($this->link); $regex = '/<link rel="video_src" href="(.*?)"/is'; preg_match($regex, $content, $matches); $Content = curlClass::getInstance()->getRedirectURL($matches[1]); $regex = '/file=(.*)&autostart/'; preg_match($regex, $Content, $matches); $Content = $matches[1]; $xml = simplexml_load_file($Content, null, LIBXML_NOCDATA); if ($xml) { switch ($this->type) { case 'bai-hat': $output[] = new Track(trim($xml->track->creator), $xml->track->title, $xml->track->creator, $xml->track->location, $xml->track->info, $xml->track->image); break; case 'playlist': $count = count($xml->track); for ($i = 0; $i < $count; $i++) { $output[] = new Track(trim($xml->track[$i]->creator), $xml->track[$i]->title, $xml->track[$i]->creator, $xml->track[$i]->location, $xml->track[$i]->info, $xml->track[$i]->image); } break; } } return $output; }
public function GetTrack() { $output = array(); $fakePath = $this->GetFakePath(); switch ($this->type) { //https://soundcloud.com/newyorker/the-political-scene-june-13 case 'sound': $trackinforURL = "http://api.soundcloud.com/resolve.json?url={$this->link}&client_id={$this->clientID}"; $content = curlClass::getInstance()->fetchURL($trackinforURL); $trackJS = json_decode($content); if ($trackJS) { $this->id = $trackJS->id; $streamURL = $fakePath . "soundcloud/{$this->clientID}/{$trackJS->id}.mp3"; $output[] = new Track($trackJS->tag_list, $trackJS->title, $trackJS->user->username, $streamURL, $trackJS->genre, $trackJS->artwork_url); } break; //https://soundcloud.com/grimeybear/sets/swi-ch //https://soundcloud.com/grimeybear/sets/swi-ch case 'set': $trackinforURL = "http://api.soundcloud.com/resolve.json?url={$this->link}&client_id={$this->clientID}"; $trackJS = json_decode(curlClass::getInstance()->fetchURL($trackinforURL)); if ($trackJS) { $tracks = $trackJS->tracks; $count = count($tracks); for ($i = 0; $i < $count; $i++) { $streamURL = $fakePath . "soundcloud/{$this->clientID}/" . $tracks[$i]->id . ".mp3"; $output[] = new Track($tracks[$i]->tag_list, $tracks[$i]->title, $tracks[$i]->user->username, $streamURL, $tracks[$i]->genre, $tracks[$i]->artwork_url); } } break; } return $output; }
public static function getInstance($debug = FALSE) { if (self::$instance === NULL) { self::$instance = new curlClass($debug); } return self::$instance; }
public function GetTrack() { $output = array(); $content = curlClass::getInstance()->fetchURL($this->link); $regex = '#xmlPath=(.+?)\\&#si'; if (preg_match_all($regex, $content, $matches) == false) { return array(Track()); } $xml = simplexml_load_file($matches[1][0], null, LIBXML_NOCDATA); if ($xml) { switch ($this->type) { case 'nghe-nhac': $song = $xml->playlist->song; $urlSource = trim($song->mp3link); $output[] = new Track($song->artist, $song->name, $song->artist, $urlSource); break; case 'xem-video': $output[] = new Track($xml->track->name, $xml->track->name, $xml->track->name, $xml->track->sourceUrl); break; case 'nghe-playlist': case 'nghe-album': $songs = $xml->playlist->song; foreach ($songs as $key => $song) { $output[] = new Track($song->artist, $song->name, $song->artist, trim($song->mp3link), "", $xml->playlist->img); } break; } } return $output; }
public function GetTrack() { $output = array(); $content = curlClass::getInstance(true)->fetchURL($this->link); $regex = '#xmlURL=(.+?)\\&\\;textad#s'; if (preg_match_all($regex, $content, $matches) == false) { return array(new Track()); } $xmlURL = $matches[1][0]; $xml = simplexml_load_file("compress.zlib://" . $xmlURL, 'SimpleXMLElement', LIBXML_NOCDATA); if ($xml) { switch ($this->type) { case 'bai-hat': $urlSource = explode("?", trim($xml->urlSource)); $output[] = new Track($xml->singer, $xml->title, $xml->singer, $urlSource[0]); break; case 'video-clip': if ($xml->item->f1080) { $output[] = new Track($xml->item->performer, $xml->item->title, $xml->item->performer, $xml->item->f1080); } else { if ($xml->item->f720) { $output[] = new Track($xml->item->performer, $xml->item->title, $xml->item->performer, $xml->item->f720); } else { if ($xml->item->f480) { $output[] = new Track($xml->item->performer, $xml->item->title, $xml->item->performer, $xml->item->f480); } else { if ($xml->item->f360) { $output[] = new Track($xml->item->performer, $xml->item->title, $xml->item->performer, $xml->item->f360); } } } } break; case 'playlist': case 'album': foreach ($xml->item as $key => $item) { //Chay rat cham va tang time, chi su dung khi that su can thiet //$item->source = curlClass::getInstance()->getRedirectURL($item->source); $output[] = new Track($item->performer, $item->title, $item->performer, $item->source); } break; } } return $output; }
function getZodiacInfo($zodiac = "") { $curl = curlClass::getInstance(); $content = $curl->fetchURL("http://senviethoroscop.appspot.com/zodiac.json?zodiac=" . $zodiac); return json_decode($content); }