Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using API to get Covers - URL Error

Tags:

json

php

I need some album covers for my PHP website but something is not working anymore.

I was using a JSON to get Album ID and then i was using this id to get the album cover.

My problem is that i try to decode a json from website but i don't get any result anymore (it was working before ...).

Here is the code (getting JSON and decoding it) :

$req="http://api-v3.deezer.com/1.0/search/track/?q=".$deezer."&index=0&nb_items=8&output=json";
$result = file_get_contents($req);
$testjson=json_decode($result,true);
like image 718
brazBrow Avatar asked Nov 19 '25 04:11

brazBrow


1 Answers

I think you are using an old code of Deezer api (1.0 and I don't get any JSON from your url).

Try to change $req by :

$req="http://api.deezer.com/2.0/search/album/?q".$deezer."&index=0&nb_items=8&output=json";

Then, some code are missing and are important to change too.

When you try to get your image, don't forget to change the url too with that version (2.0).

You can find more information on Deezer Api : here.

like image 196
ChapMic Avatar answered Nov 20 '25 18:11

ChapMic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!