Skip to content

Instantly share code, notes, and snippets.

@koenhendriks
Created December 9, 2015 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koenhendriks/30d37877423767e1235b to your computer and use it in GitHub Desktop.
Save koenhendriks/30d37877423767e1235b to your computer and use it in GitHub Desktop.
Simple scrapper for deep in radio
<?php
/**
* Radio Scanner
* Created by: koen
* Date: 12/9/15
* Time: 12:44 PM
*/
require_once('simple_html_dom.php');
function getInfo(){
$info = new stdClass();
$html = file_get_html('http://www.deepinradio.com/_content/info/playing.html');
$artist = $html->find('span[id=currently-playing-artist]',0);
$title = $html->find('span[id=currently-playing-title]',0);
$image = $html->find('img[id=currently-playing-picture]', 0);
$info->artist = strip_tags($artist);
$info->title = strip_tags($title);
$info->image = $image->src;
return $info;
}
//example usage:
$info = getInfo();
echo 'Artist: '.$info->artist;
echo '<br/>';
echo 'Title: '.$info->title;
echo '<br/>';
echo 'Image url: '.$info->image;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment