atmoner

class.soundcloud.php

Jul 11th, 2012
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.42 KB | None | 0 0
  1. <?php
  2.  
  3. ####################################
  4. # Dev: Atmoner
  5. # http://atmoner.com
  6. ####################################
  7.  
  8. class soundCloud{
  9.     # Var    
  10.    private $soundCloudServer = "http://media.soundcloud.com/stream/";
  11.    
  12.     public function getMp3($uri) {
  13.       # code...        
  14.        $fullPageSource = file($uri);
  15.         $fullPageSource = implode("", $fullPageSource);        
  16.         $streamURIPos = strpos($fullPageSource, $this->soundCloudServer, 0);        
  17.         if(!$streamURIPos)
  18.             return false;        
  19.         $streamURIArray = substr($fullPageSource, $streamURIPos);
  20.         $streamURIArray = explode('"', $streamURIArray);
  21.         $streamURI = $streamURIArray[0];        
  22.         unset($streamURIArray);
  23.        
  24.         if(!strstr($streamURI, $this->soundCloudServer))
  25.             return false;
  26.        
  27.         return $streamURI;        
  28.     }    
  29.    public function exploserChaine( $chaine ){
  30.       # code...
  31.       $to = '.,;:!?/&"';
  32.        $from = '          ';
  33.        $chaine = strtr( $chaine, $to, $from );
  34.        $tabTemp = explode( ' ', $chaine );
  35.        strip_tags($tabTemp);
  36.        foreach( $tabTemp as $k => $v ){
  37.            if($v != NULL){
  38.                if(preg_match('#(.*){1}(\')#', $v, $matches)){
  39.                    $v = substr($v, 2);
  40.                 }
  41.                $tabChaine[] = $v;
  42.            }
  43.        }
  44.        return $tabChaine;
  45.    }
  46. }
  47.  
  48. ?>
Advertisement
Add Comment
Please, Sign In to add comment