Created
          December 9, 2015 12:32 
        
      - 
      
- 
        Save koenhendriks/30d37877423767e1235b to your computer and use it in GitHub Desktop. 
    Simple scrapper for deep in radio
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?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