nisaar Posted November 10, 2011 Share Posted November 10, 2011 Hi All .... I am new to php and i am droning over here ... We are starting a new online store and I am having a huge problem with my music API. What happens is that the api does a search ...I can vouch for that because I have a mailer that sends me a failed list ...@ this point everything cannot be found. My Dvd's working with the IMDB Api works perfectly and all the info gets stored to my MySql DB. This is my code for the music function GetMusicData($album, $artist, $id) { global $db; $artist = str_replace(" ", "+", $artist); $artist = strtolower($artist); $album = str_replace(" ", "+", $album); $url='http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=801bf08fc2c46659ad7878778edb72b3&artist='.$artist.'&album='.$album.'&autocorrect=1' ; $ch = curl_init ($url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_BINARYTRANSFER,1); $dt=curl_exec($ch); curl_close ($ch); $data = new SimpleXmlElement($dt, LIBXML_NOCDATA); $tracklist = NULL; $x = (array)$data; Any help would be much appreciated as I can't see why I am not able to get any information. I have just over 9000 entries in my DB of well known and not so well known artists but I can't find any information. Quote Link to comment https://forums.phpfreaks.com/topic/250845-music-api-not-searching-any-data/ Share on other sites More sharing options...
nisaar Posted November 10, 2011 Author Share Posted November 10, 2011 ok so I changed my API ... now i am getting another error " Error: Client does not accept gzip encoding." Below is my code: Function GetMusicData($price, $album, $artist, $id) { global $db; $artist_name = $db->get("select name from music limit 100"); $title = $db->get("select description_short from music limit 100"); $artist = str_replace(" ", "+", $artist); $artist = strtolower($artist); $album = str_replace(" ", "+", $album); $url='http://api.discogs.com/search?type=releases&q=-format:"promo"+format:"album"+format:"CD"+title:"$title"+artist:"$artist_name"~&f=xml' .$artist.'&album='.$album.'&autocorrect=1'; $ch = curl_init ($url); curl_setopt($ch, CURLOPT_HEADER, 'Accept-Encoding: gzip'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_BINARYTRANSFER,1); curl_setopt($curl, CURLOPT_ENCODING, 'gzip, deflate'); $dt=curl_exec($ch); curl_close ($ch); $data = new SimpleXmlElement($dt, LIBXML_NOCDATA); $tracklist = NULL; $x = (array)$data; Quote Link to comment https://forums.phpfreaks.com/topic/250845-music-api-not-searching-any-data/#findComment-1287141 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.