當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Curl::getArray方法代碼示例

本文整理匯總了PHP中Curl::getArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP Curl::getArray方法的具體用法?PHP Curl::getArray怎麽用?PHP Curl::getArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Curl的用法示例。


在下文中一共展示了Curl::getArray方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: nextSong

 /**
  * get the next song in the playlist
  */
 private function nextSong()
 {
     $curl = new Curl();
     $songArray = $curl->getArray("http://8tracks.com/sets/" . $this->playToken . "/next?mix_id=" . $this->mixId . "&api_version=2&format=jsonh");
     $status = $songArray["status"];
     if (!preg_match('/(200)/', $status)) {
         if (preg_match('/(403)/', $status)) {
             $this->output->error("8tracks made a boo boo. (" . $status . ")", 403);
         } else {
             $this->output->error("8tracks made a boo boo. (" . $status . ")");
         }
     }
     if (isset($songArray["set"]["track"]["id"])) {
         $songId = $songArray["set"]["track"]["id"];
         $title = $songArray["set"]["track"]["name"];
         $artist = $songArray["set"]["track"]["performer"];
         $album = $songArray["set"]["track"]["release_name"];
         $duration = $songArray["set"]["track"]["play_duration"];
         $songUrl = $songArray["set"]["track"]["url"];
         $song = $this->db->select("SELECT mixId FROM 8tracks_playlists_songs WHERE mixId=? AND songId=? LIMIT 1", array($this->mixId, $songId), array("%d", "%d"));
         if (empty($song)) {
             $this->db->insert("8tracks_playlists_songs", array("mixId" => $this->mixId, "songId" => $songId, "trackNumber" => $this->trackNumber), array("%d", "%d", "%d"));
             $song = $this->db->select("SELECT songId FROM 8tracks_songs WHERE songId=? LIMIT 1", array($songId), array("%d"));
             if (empty($song)) {
                 $this->db->insert("8tracks_songs", array("songId" => $songId, "title" => $title, "artist" => $artist, "album" => $album, "duration" => $duration, "songUrl" => $songUrl), array("%d", "%s", "%s", "%s", "%d", "%s"));
             }
         }
     } else {
         $this->output->error("That's all we could find.");
     }
 }
開發者ID:5eiko,項目名稱:psychic-rotary-phone,代碼行數:34,代碼來源:EightTracks.php

示例2: getNextSong

 /**
  * Get song info from URL.
  */
 private function getNextSong()
 {
     // Grab song info.
     $curl = new Curl();
     $array = $curl->getArray("http://songza.com/api/1/station/" . $this->stationId . "/next", "sessionid=" . $this->sessionId . "; visitor-prompted:1");
     // Clean up array.
     $array = array("id" => $array["song"]["id"], "title" => $array["song"]["title"], "artist" => $array["song"]["artist"]["name"], "album" => $array["song"]["album"], "genre" => $array["song"]["genre"], "url" => $array["listen_url"], "coverUrls" => array("small" => $array["song"]["cover_url"], "medium" => $array["song"]["cover_url"], "large" => $array["song"]["cover_url"]), "duration" => $array["song"]["duration"]);
     // Add to output array.
     $this->outputArray["song"] = $array;
 }
開發者ID:nightley,項目名稱:omgcatz,代碼行數:13,代碼來源:Songza.php


注:本文中的Curl::getArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。