PDA

View Full Version : More PHP Help



:Edzy
01-06-2008, 11:17 PM
Anyone know what is wrong with this?


<?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


//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

:Edzy
01-06-2008, 11:34 PM
Sorry about double post

addition:

how do i remove the t_string error from


<img src="$thing">

Hypertext
02-06-2008, 02:50 AM
<img src=\"" . $thing. "\">

Protege
02-06-2008, 11:39 AM
$string = '<img src="' . $thing . '">';

Single quotes are better.

Want to hide these adverts? Register an account for free!