$data = "https://api.blastfmmusicart.com/api.php?".http_build_query(array("artist" => $searchArtist, "track" => $searchTrack, "api" => $yourApiKey));
<img src="<?php echo file_get_contents($data); ?>" alt="someThing" />
All database queries should be fully url encoded, they will be decoded by the API
Assuming that $searchArtist contains the name of an artist and/or $searchTrack contains the name of a music track and $yourApiKey contains a valid API key, a result can be fetched.
Optionally, a domain parameter can also be sent which contains the domain name of the host making the API call.
The API returns one of three things, (A) The URL of the image media (B) A NULL value if no image was found (C) an error message describing certain conditions, for example, a missing API key
Additionally, it is not a good idea to check the return data for empty, example: if (!empty($data)) {} because if an error message is returned, it is not empty, but it is not an image URL either.
The best way to check the return data, in PHP anyway, is to use a regular expression to check if the return data is a link to an image file. Example: if (preg_match("/^http.*[\.jpg|\.jpg|\.jpeg|\.png]$/i", $returnData)) {/*I got an image!*/}
The API is fully hand coded by © BlastFM Limited 2019
Visit our Artwork Gallery at https://blastfmmusicart.com/gallery
More API information is available at: https://blastfmmusicart.com/page/blastfm-limited-music-art-api-support
Version 1.8.4