-
More PHP Help
Anyone know what is wrong with this?
PHP Code:
<?php
header("Content-Type: image/gif");
$artist = $_GET['artist'];
$artist = urldecode($artist);
$url = "http://www.last.fm/music/" . $artist . "/";
$url = eregi_replace(" ", "+", $url);
$data = file_get_contents($url);
if(!file_get_contents($url)) {
echo "<img src='noart.jpg'>";
}
$image1start = explode('<div class="imgHolder">', $data);
$image1end = explode('</div>', $image1start[1]);
$image1 = trim($image1end[0]);
$imagestart = explode('<img src="', $image1);
$imageend = explode('" alt', $imagestart[1]);
$image = trim($imageend[0]);
echo $image;
?>
Its supposed to show the bands last.fm image because i couldnt do album art
PHP Code:
//display stats
if($streamstatus == "1"){
//you may edit the html below, make sure to keep variable intact
$name = explode(" - ", $song[0]);
$sname = explode($song[0], " - ");
$sartist = $sname[0];
$artist = $name[0];
$url = "album.php?artist=$artist";
$url = eregi_replace(" ", "+", $url);
$thing = file_get_contents($url);
echo("
And also, i've managed to get the song artist seperate using $artist but how do i get the song name seperate using $sartist?
Cheers -Ed
-
Sorry about double post
addition:
how do i remove the t_string error from
PHP Code:
<img src="$thing">
-
<img src=\"" . $thing. "\">
-
$string = '<img src="' . $thing . '">';
Single quotes are better.