We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Tom's 103 Analysis</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <?php /* Author: Tom Hacquoil Date: 25th August 2010 */ /* PART 1: Get currently playing song and artist. */ # Put the contents of the source of the destination website into a 'content' variable. $content = file_get_contents('http://www.channel103.com/music/index.php?qty=50'); # Using Regular Expressions, scan the file and everytime a match occurs, put data into the 'data' array. preg_match('#<div><span>now playing – </span><a href="http://www.channel103.com/music/index.php">(.*)</a><span>(.*)</span></div>#', $content, $data); # Assign the contents of the 'data' array to two variables, song and artist. $song = $data; $artist = $data; # Print the content of those variables. echo "<strong>Song:</strong> $song - <strong>Artist:</strong> $artist\n"; echo "<br /><br />"; /* PART 2: Get a list of all recently played songs. */ # Put the contents of the source of the destination website into a 'content' variable. $content = file_get_contents('http://www.channel103.com/music/index.php?qty=20333'); # Using Regular Expressions, scan the file and everytime a match occurs, put data into the 'data' array. preg_match('#<tr class="tabletextRow1"><td>(.*)</td>#', $content, $data); # Print first entity of the array (for testing). echo $data; echo "<br /><br /><br />"; # Print the entire array. (For testing). print_r($data); ?> </body> </html>
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|Question about Common Table Expressions||3||44|
|Inserting HTML Code on Wordpress Homepage for Affiliate Marketing Tracking||3||18|
|Doubt with angularJs with PHP||4||17|
Join the community of 500,000 technology professionals and ask your questions.