Warning: file_get_contents(http://www.last.fm/music/Boys Like Girls) [function.file-get-contents]: failed to open stream: HTTP request failed! in /home/skylight/public_html/testalbum.php on line 5

Warning: file_get_contents(http://www.last.fm/music/Boys Like Girls) [function.file-get-contents]: failed to open stream: HTTP request failed! in /home/skylight/public_html/testalbum.php on line 5
so i have to add each band/artist manuallyWell this is how you would do it... (Would be a picture of the artists)
-> Get artist name
-> Get files contents of the artist - http://www.last.fm/music/artist
You would have to replace a space with a "+"
eg) http://www.last.fm/music/U2
-> Get the content of
using eregiHTML Code:<div class="imgHolder"></div>
Good luck
isnt there a simpler code to just stick into the stats so it grabs it from the sound file playing because SAM can read it :S
EDTALKING
Just get the artist out of the Now Playing (try exploding by " - " and then using $variable[0] to get the artist name) and then just put that into the URL you want to query.
i used to be NintendoNews. visit my blog or add me on twitter.
need help with vista? i am a microsoft certified technology specialist in configuring windows vista and connected home integrator.. pm me for help!
"I am the way, the truth, and the life. No one comes to the Father except through me"
John 14:6 (NIV)
i have mine working but it always adds %20's and never works. And with URL Decode it messes up
I have this working with spaces etc.
http://thomas.uk.to/artist.php?artist=The Fratellis
Doesnt make the page an image using GD though.PHP Code:<?php
$artist = $_GET['artist'];
$artist = urldecode($artist);
$url = "http://www.last.fm/music/" . $artist . "/";
$url = eregi_replace(" ", "+", $url);
$data = file_get_contents($url);
$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 '<img src="' . $image . '">';
?>
I have also made one to recieve the artists latest album.
http://thomas.uk.to/album.php?artist=The Fratellis
PHP Code:<?php
$artist = $_GET['artist'];
$artist = urldecode($artist);
$url = "http://www.last.fm/music/" . $artist . "/+albums?order=date";
$url = eregi_replace(" ", "+", $url);
$data = file_get_contents($url);
$image1start = explode('<div class="cover">', $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 '<img src="' . $image . '">';
?>
Last edited by ZAG; 16-02-2007 at 04:39 PM.
“two players, two sides.
one is light, one is dark.”
- John Locke
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);
$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]);
$image2 = imagecreatefromjpeg($image);
imagegif($image2);
?>
There you go
Wish last.fm wasnt so slow though
“two players, two sides.
one is light, one is dark.”
- John Locke
Yea but it gets used alot so it takes a while.
=[
How can I explode: Dawn of the Dude - Set Us Free
into just Dawn of the Dude?
Last edited by Dentafrice1; 16-02-2007 at 04:49 PM.
PHP Code:<?php
$song_data = "Dawn of the Dude - Set Us Free";
$song_data_exploded = explode(" - ", $song_data);
?>
i used to be NintendoNews. visit my blog or add me on twitter.
need help with vista? i am a microsoft certified technology specialist in configuring windows vista and connected home integrator.. pm me for help!
"I am the way, the truth, and the life. No one comes to the Father except through me"
John 14:6 (NIV)
Want to hide these adverts? Register an account for free!