Forum Moderators: coopster

Message Too Old, No Replies

Grabbing current song title?

         

war59312

11:28 pm on Aug 20, 2006 (gmt 0)

10+ Year Member



Hi,

I am trying to simply grab the title of the currently playing song on www.example.com.

Well, here is what I have at the moment; yes it works:

<?php

/*

Created By: War59312 (Will's Blog - < snipped url per Terms of Service >)
Date: August, 20th 2006
Description: Simply grabs the now playing song title from example.com and prints it out on the screen

*/

$url = 'example.com'; //do NOT include http://

/* Guess? lol */
$page =file_get_contents("http://" . $url . ":80/index.php");
eregi('<td>(.*)</td>', $page, $result); $results = explode("</td>", $result); $resultss = explode(" ", $results[54]);
echo "<strong>Currently Listening To</strong>: $results[54]"

/* Debug - Print Out Given Array Values For $results - Un-comment To Use */
//;print_r(array_values($resultss));

?>


So what is the problem, you ask...

It prints out the html code too. Part of the table that is... I just want it to print out the title and nothing more...

Thanks for your help,

Will

[1][edited by: coopster at 12:57 pm (utc) on Aug. 21, 2006]
[edit reason]
[1][edit reason] removed url per TOS [webmasterworld.com] [/edit]
[/edit][/1]

smatts9

1:57 am on Aug 21, 2006 (gmt 0)

10+ Year Member




<?php
/*

COMPLETE EDITED AND MADE AWESOME BY SMATTS9

*/

$url = 'example.com'; //do NOT include http://
$page=file_get_contents("http://" . $url . ":80/index.php");
eregi('<td height=\"30\" class=\"last\">(.*)<br>', $page, $result);
$results = explode("<br>", $result[1]);
echo $results[0];
?>

You dont need that comment if you dont want to put it in ;) but it should work, until they change their layout.

[edited by: coopster at 12:58 pm (utc) on Aug. 21, 2006]
[edit reason]
[1][edit reason] generalized domain [/edit]
[/edit][/1]

war59312

3:05 am on Aug 21, 2006 (gmt 0)

10+ Year Member



Hey,

Oh now I understand. Cool! :)

Thanks a lot.

Will