Deezerからサーバーにalbumartを保存するためのこのスクリプトがあります。albumartのURLは大丈夫です、あなたは自分で試すことができます。そして、それはファイルを作成しますが、それは私が見たい画像ではなく、破損したファイルです。APIから取得した元のリンクにアクセスしたときに提供される(おそらく)301と関係があると思います。しかし、それがそれであるならば、私はその問題を解決するために熱心に知りません。
<?php
// Deezer
$query = 'https://api.deezer.com/2.0/search?q=madonna';
$file = file_get_contents($query);
$parsedFile = json_decode($file);
$albumart = $parsedFile->data[0]->artist->picture;
$artist = $parsedFile->data[0]->artist->name;
$dir = dirname(__FILE__).'/albumarts/'.$artist.'.jpg';
file_put_contents($dir, $albumart);
?>