-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest2.php
More file actions
28 lines (24 loc) · 819 Bytes
/
test2.php
File metadata and controls
28 lines (24 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
$artist = $_GET["artist"];
$album = $_GET["album"];
$track= $_GET["track"];
$track = str_replace(' ', '+', $track);
$url = "https://itunes.apple.com/search?term=$track&media=music&country=US&entity=song&limit=300";
$content = file_get_contents($url);
$json = json_decode($content,true);
foreach ($json['results'] as $item){
$tempArtistName = ($item[artistName]);
$newimagelink = ($item[artworkUrl100]);
if(stripos($tempArtistName,$artist) !== false){
$newimagelink = ($item[artworkUrl100]);
echo $newimagelink;
break;
}
}
if(strpos($newimagelink,'mzstatic') !== false){
$newimagelink = str_replace("100x100","225x225",$newimagelink);
header ("Location: ".$newimagelink);
}else{
header ("Location: http://server.gursimran.net/default.jpg");
}
?>