当前位置: 首页>>代码示例>>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;未经允许,请勿转载。