mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
71fe020f84
git-svn-id: https://svn.fhem.de/fhem/trunk@3 2b470e98-0d58-463d-a4d8-8e2adae1ed80
49 lines
850 B
Perl
Executable File
49 lines
850 B
Perl
Executable File
#!/usr/bin/perl
|
|
|
|
use XML::XSLT;
|
|
use CGI;
|
|
use warnings;
|
|
use IO::Socket::INET;
|
|
|
|
my $host="localhost:7072";
|
|
my $xsl="/home/httpd/cgi-bin/xsl/hfm_tc.xsl";
|
|
|
|
sub
|
|
getXmlList() {
|
|
my $server = IO::Socket::INET->new(PeerAddr => $host);
|
|
my $str = "";
|
|
|
|
if ($server) {
|
|
my $buf;
|
|
|
|
syswrite($server, "xmllist; quit\n");
|
|
while(sysread($server, $buf, 256) > 0) {
|
|
$str .= $buf
|
|
}
|
|
} else {
|
|
$str="<ERROR msg='Cannot connect to the server'/>\n";
|
|
}
|
|
return $str;
|
|
}
|
|
|
|
|
|
my $cgi = new CGI;
|
|
print $cgi->header( "-type" => "text/html",
|
|
"-Expires" => "0",
|
|
"-Cache-Control" => "no-chache",
|
|
"-Pragma" => "no-cache"
|
|
);
|
|
|
|
|
|
my $xml=getXmlList();
|
|
|
|
my $xslt = XML::XSLT->new ($xsl, warnings => 1);
|
|
|
|
$xslt->transform ($xml);
|
|
print $xslt->toString;
|
|
$xslt->dispose();
|
|
|
|
|
|
|
|
|