Guest User

Untitled

a guest
Apr 22nd, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. function listenersIP(){
  2. $auth = sprintf("Authorization: Basic %s\r\n", base64_encode(ICECAST_ADMIN_USER.':'.ICECAST_ADMIN_PASS));
  3.  
  4. $context = stream_context_create(array(
  5. 'http' => array(
  6. 'header' => $auth
  7. )
  8. ));
  9.  
  10. var_dump($auth);
  11. var_dump($context);
  12.  
  13. //ini_set('user_agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10');
  14. $d = file_get_contents(USERS_XML_ICECAST_FEED, false, $context);
  15.  
  16. var_dump($d);
  17.  
  18. if (!$d)
  19. return false; // Failed to open connection
  20.  
  21. $icecast_listeners_xml = new SimpleXMLElement($d);
  22.  
  23. foreach ($icecast_listeners_xml->source[0]->listener as $listener) {
  24. $ips[] = $listener->IP;
  25. }
  26.  
  27. return $ips;
  28. }
Add Comment
Please, Sign In to add comment