php.de

Zurück   php.de > Webentwicklung > PHP Einsteiger > PHP Tipps 2005-2

 
 
LinkBack Themen-Optionen Thema bewerten
Alt 04.08.2005, 07:04  
Neuer Benutzer
 
Registriert seit: 04.08.2005
Beiträge: 7
Sonic84
Standard Shoutstats

Hallo,

Wer kann mir denCode so umschreiben das Shoutstats die XML ausliest und nicht die 7.html

Hier erstmal der Standartcode:
Code:
<?
// Shoutstats version
define('SS_VERSION',	'0.8.4');

// The file providing the the config variables
define('SS_CONF',	'config.ini');

// The file providing the server list
define('SS_SERVERS',	'servers.ini');

// The folder containing the generated PNG
define('SS_PATH_GFX',	'gfx');

// The folder containing the RRDtool databases
define('SS_PATH_RRD',	'rrd');

if (!file_exists(SS_CONF))
	die(SS_CONF.' file is missing');
$configuration = parse_ini_file(SS_CONF, TRUE);
define('SS_RRDTOOL_COMMAND', $configuration['Configuration']['rrdtool_command']);
define('SS_NAME', $configuration['Configuration']['stream_name']);

//if(!is_executable(SS_RRDTOOL_COMMAND))
//	die(SS_RRDTOOL_COMMAND . ' not found. Please update the ' . SS_CONF . ' file');
exec(SS_RRDTOOL_COMMAND, $output);
if(!count($output))
	die(SS_RRDTOOL_COMMAND . ' not found. Please update the ' . SS_CONF . ' file');

//
// Get the server list from the configuration file
//

function GetServerList()
{
	if (!file_exists(SS_SERVERS))
	        die(SS_SERVERS.' file is missing');

	$servers = parse_ini_file(SS_SERVERS, TRUE);
	ksort($servers);
	
	if (!count($servers))
	        die('no server configured, edit the '.SS_CONF.' file');
	
	return $servers;
}

//
// Get the number of current and max listeners from the specified server
//

function GetShoutcastStats($host,$port)
{
  $fp = fsockopen($host, $port, $errno, $errstr, 30);

  // can't connect =(
  if (!$fp) {
	print("$errstr ($errno)
\n");
	$server['current'] = 0;
	$server['max'] = 0;
  // oh yes, it can connect
  } else { 
      fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)\r\n\r\n");
      while (!feof($fp)) {
          $content .= fgets($fp,128);
      }
      fclose($fp);

      $debut = strpos($content, '<body>') + strlen('<body>');
      $fin = strpos($content, '</body>', $debut);
      $string = substr($content, $debut, $fin - $debut);
	  
	  $stats = explode(',', $string);

	// server is up but no source is connected
	if ($stats[1] == 0) {
		$server['current'] = 0;
	// everything is ok
	} else {
		$server['current'] = $stats[0];
	}
	
	$server['max'] = $stats[3];
  }

	// debug
	// print("$host:$port = {$server['current']}/{$server['max']}\n");
  return $server;
}

//
// Template used to display each generated graph
//

function DisplayGraph($txt_freq, $rrdgfx) {
$size  = GetImageSize($rrdgfx);
?>



<?=$txt_freq?> graph:

[img]<?=$rrdgfx?>[/img] alt="<?=$txt_freq?> graph" />

</p>
<? } ?>
Jetzt sagte man mir dass das nicht gehen würde die XML auszulesen, weil der Code nur HTML dateien auslesen würde und man müsse das ganze Umbauen, sprich umcoden. Stimmt das und wenn ja wer kann mir dabei helfen da ich mit php-scripting kaum bis keine erfahrung habe.

Vielen Dank schon mal im Voraus.

LG
Sonic84
Sonic84 ist offline  
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

 


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Shoutstats Sonic84 PHP Tipps 2006 3 31.03.2006 19:53

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
shoutstats auslesen, define(\'ss_servers\',, shoutstats rrdtool not found, ss_rrdtool_command, shoutstats size

Alle Zeitangaben in WEZ +2. Es ist jetzt 07:29 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum

Creative Commons License
Dieser Inhalt ist unter einer Creative Commons-Lizenz lizenziert.