XAMPP Windows XML,XSL

Irgendwelche Probleme mit XAMPP für Windows? Dann ist hier genau der richtige Ort um nachzufragen.

XAMPP Windows XML,XSL

Postby DO9ATV » 02. September 2011 12:39

Hallo,
hello,

ich habe ein großes Problem mit XAMPP (neuste Version) für Windows und XML :-(
i have a big problem with XAMPP (newest version) for Windows and XML :-(

PHP ist aktiviert und in der php.ini ist php_xsl.dll als extansion eingetragen, doch leider bekomme ich immer nur eine Fehlermeldung vom Internet Explorer:
PHP is aktiv and in the php.ini is php.xsl.dll as extansion input, because i become only a errormessage from Internet Explorer:

Script:
<?php
$indexurl = 'http://localhost/';
$XML = new DOMDocument();
$XML->load($indexurl, LIBXML_NOCDATA);
$xslt = new XSLTProcessor();
$XSL = new DOMDocument();
$XSL->load('STARnet4.xsl', LIBXML_NOCDATA);
$xslt->importStylesheet( $XSL );
print $xslt->transformToXML( $XML );
?>

Errormessage:
Warning: DOMDocument::load() [domdocument.load]: Extra content at the end of the document in http://localhost/, line: 2 in C:\xampp\htdocs\index2.php on line 4

Kann mir irgendwer sagen, was ich XAMPP PHP noch sagen muss, damit es klappt ?
Kann me everyone say, what i must write down XAMPP, that it run ?

Mfg Marco
DO9ATV
 
Posts: 5
Joined: 02. September 2011 12:33

Re: XAMPP Windows XML,XSL

Postby Nobbie » 03. September 2011 00:24

DO9ATV wrote:Kann mir irgendwer sagen, was ich XAMPP PHP noch sagen muss, damit es klappt ?


Gar nichts.

Du musst die Fehlermeldung lesen und verstehen und den dort beschriebenen Fehler beheben. Die Meldung bedeutet, dass die XML Extensions offensichtlich funktionieren und dass das gezeigte Script ausgeführt wird, auf Zeile 4 Deines Scripts wird ein XML Dokument geladen via $XML = load($indexurl, LIBXML_NOCDATA);

Und die Fehlermeldung sagt, dass bei diesem Laden des XML Dokuments ein Fehler auftritt, nämlich auf Zeile 2 des Dokumentes http://localhost/index2.php befindet sich am Ende der 2. Zeile irgendein ungültiges Zeichen. Da der Wert von $indexurl aber nur auf http://localhost/ verweist, ist entweder Apache so konfiguriert, dass es in diesem Fall die Datei index2.php ausliefert, oder es steht ein include() in einer index.php oder oder - das kannst nur Du selbst wissen. So oder so ist ein XML Load auf http://localhost/ relativ seltsam, denn dort wird ein XML Dokument erwartet, was durch so eine URL aber nicht sichergestellt ist und auch nicht erkennbar ist.
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04

Re: XAMPP Windows XML,XSL

Postby DO9ATV » 03. September 2011 10:58

Hallo Nobbi,

das ist eine richtig saubere Erklärung, erst einmal besten Dank dafür, ich poste Dir mal eben den Anfang der index.php :

<?php
if(strstr($_SERVER['HTTP_USER_AGENT'],'MSIE')) header("Location: index2.php");

require_once('local.php');

$dom = new DOMDocument("1.0");
$configs = array();

Der Autor hat das ganze eigentlich für eine Systemabfrage unter Linux erstellt, jedoch habe ich das mit seiner Hilfe halb für Windows umgebaut.
Unter z.B. Opera läuft das auch soweit, nur IE macht mir die Probleme.
Er sagte, da IE die eigentliche Sprache nicht versteht hat er die zusätzliche "Notlösung" mit XML gewählt.
Da die User, welche auf die Webseite zugreifen zum Großteil auch mit IE arbeiten muss ich dieses auch anbieten.
Jedoch kann ich den Fehler nicht finden, trotz suche im Internet. Laut php soll das alles so passen, eher schrieben die,
das XML unter Windows XAMPP also php nicht untersützt werden solle , nur unter XAMPP für Linux ?

Vielen Dank vorweg, ich hoffe Du erkennst doch irgendwas falsches, anscheinend habe ich irgendwas im php übersehen...

Marco
DO9ATV
 
Posts: 5
Joined: 02. September 2011 12:33

Re: XAMPP Windows XML,XSL

Postby DO9ATV » 05. September 2011 13:03

Hallo,

keine Idee ? Habe wieder einiges probiert, leider alles ohne Erfolgserlebnis. Ich habe mit dem Autor gesprochen, ich darf den Quellcode hier rein stellen.

Mfg
Marco

XAMPP unter Windows
Warning: DOMDocument::load() [domdocument.load]: Extra content at the end of the document in http://localhost/, line: 2 in C:\xampp\htdocs\index2.php on line 4

index2.php
<?php
$indexurl = 'http://localhost/';
$XML = new DOMDocument();
$XML->load($indexurl, LIBXML_NOCDATA);
$xslt = new XSLTProcessor();
$XSL = new DOMDocument();
$XSL->load('STARnet4.xsl', LIBXML_NOCDATA);
$xslt->importStylesheet( $XSL );
print $xslt->transformToXML( $XML );
?>




index.php
<?php
if(strstr($_SERVER['HTTP_USER_AGENT'],'MSIE')) header("Location: index2.php");

require_once('local.php');

$dom = new DOMDocument("1.0");
$configs = array();

if ($configfile = fopen($gatewayConfigPath,'r')) {
while ($line = fgets($configfile)) {
list($key,$value) = explode("=",$line);
$value = trim(str_replace('"','',$value));
if ($key != 'ircddbPassword' && strlen($value) > 0)
$configs[$key] = $value;
}

}

if ($STARnetServer) {
$configs['gatewayCallsign'] = str_pad($callsign,7) . 'G';
$configs['latitude'] = $sslatitude;
$configs['longitude'] = $sslongitude;
}

function buildgroupinfo($dom,$configs,$starLogPath) {


$groupsx = array();
if ($starLog = fopen($starLogPath,'r')) {

while($logLine = fgets($starLog)) {
preg_match_all('/^(.{19}).*(Adding|Removing) (.{8}).*StarNet group (.{8}).*$/',$logLine,$matches);
$groupz = $matches[4][0];
$member = $matches[3][0];
$action = $matches[2][0];
$date = strtotime($matches[1][0] . ' UTC');
if ($action == 'Adding'){ $groupsx[$groupz][$member] = date('Y-m-d H:i:s T',$date); } else
if ($action == 'Removing'){
unset($groupsx[$groupz][$member]);
}
}
fclose($starLog);
}

$attributes = array( "starNetBand" => 'band',
"starNetInfo" => 'info',
"starNetUserTimeout" => 'userTimeout',
"starNetGroupTimeout" => 'groupTimeout',
"starNetReflector" => 'reflector',
"starNetLogoff" => 'logoffcall' );

$search = "starNetCallsign";
$found = false;
$callBase = substr($configs["gatewayCallsign"],0,7);
$groupsi = $dom->createElement("STARnetGroupsInfo");
$keys = array_keys($configs);
foreach($keys as $key) {
if ($pos = strstr($key,$search)) {
$found = true;
$gcall = $configs[$key];
$digits = str_replace($search,"",$key);
$group = $dom->createElement("group");
$groupsi->appendChild($group);
$callj = $dom->createAttribute("callsign");
$group->appendChild($callj);
$groupcall = $dom->createTextNode($gcall);
$callj->appendChild($groupcall);
$attrkeys = array_keys($attributes);
foreach($attrkeys as $attrkey) {
$configKey = $attrkey . $digits;
if (array_key_exists($configKey,$configs)) {
$attribute = $dom->createAttribute($attributes[$attrkey]);
$group->appendChild($attribute);
if ($attrkey == "starNetBand") $value = $dom->createTextNode($callBase . $configs[$configKey]);
else $value = $dom->createTextNode($configs[$configKey]);
$attribute->appendChild($value);
}
}
$gcallz = str_pad($gcall,8);
$keyzx = array_keys($groupsx[$gcallz]);
foreach ($keyzx as $m) {
$subscriber = $dom->createElement("subscriber");
$group->appendChild($subscriber);
$subtime = $dom->createAttribute("timestamp");
$subscriber->appendChild($subtime);
$ts = $groupsx[$gcallz][$m];
$subtimetext = $dom->createTextNode($ts);
$subtime->appendChild($subtimetext);
$subcallsign = $dom->createTextNode($m);
$subscriber->appendChild($subcallsign);
}
}
}
if ($found) {
return($groupsi);
} else {
return($dom->createComment("No Groups"));
}
}


function buildrepeaterinfo($dom,$configs) {

$attributes = array ( "range", "rangeKms", "frequency", "offset", "agl", "atStartup", "reconnect" , "ddMode" );
$search = "repeaterBand";
$found = false;
$repeaters = $dom->createElement("repeaterinfo");
$callBase = substr($configs["gatewayCallsign"],0,7);
$keys = array_keys($configs);
foreach($keys as $key) {
if ($pos = strstr($key,$search)) {
$found = true;
$digits = str_replace($search,"",$key);
$repeater = $dom->createElement("repeater");
$repeaters->appendChild($repeater);
$rptrcall = $dom->createTextNode($callBase . $configs[$key]);
$repeater->appendChild($rptrcall);
foreach($attributes as $attr) {
$configKey = $attr . $digits;
$attribute = $dom->createAttribute($attr);
$repeater->appendChild($attribute);
$value = $dom->createTextNode($configs[$configKey]);
$attribute->appendChild($value);
}
}
}
if ($found) {
return($repeaters);
} else {
return($dom->createComment("No Repeaters"));
}
}

function baseValues($dom,$root,$configs) {

$generalAttr = array("gatewayCallsign","hardwareType","latitude","longitude","ircddbHostname","ircddbUsername",
"aprsHostname","dplusEnabled","dplusLogin","language","infoEnabled","echoEnabled",
"logEnabled","remoteEnabled","repeaterTapEnabled","dratsEnabled","description1",
"description2","url","aprsEnabled","dextraEnabled");
foreach($generalAttr as $attr) {
if (array_key_exists($attr,$configs)) {
$element = $dom->createElement($attr);
$root->appendChild($element);
$value = $dom->createTextNode($configs[$attr]);
$element->appendChild($value);
} else {
$comment = $dom->createComment("No " . $attr);
$root->appendChild($comment);
}
}
}

function addlinks($dom,$parent,$linkLogPath) {
$linksdom = $dom->createElement("links");

if ($linkLog = fopen($linkLogPath,'r')) {
$i=0;
while ($linkLine = fgets($linkLog)) {
preg_match_all('/^(.{19}).*(D[A-Za-z]*).*Type: ([A-Za-z]*).*Rptr: (.{8}).*Refl: (.{8}).*Dir: (.*)$/',$linkLine,$linx);
$linkDate = strtotime($linx[1][0] . ' UTC');
$protocol = $linx[2][0];
$linkType = $linx[3][0];
$linkRptr = $linx[4][0];
$linkRefl = $linx[5][0];
$linkDir = $linx[6][0];
$linkRPT = $dom->createElement("repeater");
$linksdom->appendChild($linkRPT);
$tsAttr = $dom->createAttribute("timestamp");
$tsVal = $dom->createTextNode(date('Y-m-d H:i:s T',$linkDate));
$tsAttr->appendChild($tsVal);
$linkRPT->appendChild($tsAttr);
$protoAttr = $dom->createAttribute("protocol");
$protoVal = $dom->createTextNode($protocol);
$protoAttr->appendChild($protoVal);
$linkRPT->appendChild($protoAttr);
$typeAttr = $dom->createAttribute("type");
$typeVal = $dom->createTextNode($linkType);
$typeAttr->appendChild($typeVal);
$linkRPT->appendChild($typeAttr);
$reflAttr = $dom->createAttribute("target");
$reflVal = $dom->createTextNode($linkRefl);
$reflAttr->appendChild($reflVal);
$linkRPT->appendChild($reflAttr);
$dirAttr = $dom->createAttribute("direction");
$dirVal = $dom->createTextNode($linkDir);
$dirAttr->appendChild($dirVal);
$linkRPT->appendChild($dirAttr);
$callVal = $dom->createTextNode($linkRptr);
$linkRPT->appendChild($callVal);
$i++;
}
fclose($linkLog);
if ($i > 0) {
$parent->appendChild($linksdom);
}
}

}
function addgroups($dom,$parent,$starLogPath) {
}

function addstations($dom,$parent,$hdrLogPath) {

if ($hdrLog = fopen($hdrLogPath,'r')) {
$hdrs = array();

while ($hdrlin = fgets($hdrLog)) {
$pos = strpos($hdrlin,"Repeater header");
if ($pos !== false) {
preg_match_all('/^(.{19}).*My: (.{8}).*\/(.{4}).*Your: (.{8}).*Rpt1: (.{8}).*$/',$hdrlin,$headrs);
$datestamp = strtotime($headrs[1][0] . ' UTC');
$station = $headrs[2][0];
$comment4 = $headrs[3][0];
$your = $headrs[4][0];
$rptr1 = $headrs[5][0];

if ( preg_match('/([A-Z 0-9]{8})/',$station) == 1) $hdrs[$rptr1][$station . '/' . $comment4] = date('Y-m-d H:i:s T',$datestamp) . '|' . $your;
}
}
fclose($hdrLog);
if (count($hdrs) > 0) {
$hdrdom = $dom->createElement("rf");
$parent->appendChild($hdrdom);
$keysrptr = array_keys($hdrs);
foreach($keysrptr as $rptrkey) {
$rptrg = $dom->createElement("repeater");
$hdrdom->appendChild($rptrg);
$rptrcall = $dom->createElement("call");
$rptrg->appendChild($rptrcall);
$rptrcs = $dom->createTextNode($rptrkey);
$rptrcall->appendChild($rptrcs);
$stationkeys = array_keys($hdrs[$rptrkey]);
foreach($stationkeys as $stationcall) {
$station = $dom->createElement("station");
$rptrg->appendChild($station);
$scall = $dom->createTextNode($stationcall);
$station->appendChild($scall);
list($date,$ur) = explode("|",$hdrs[$rptrkey][$stationcall]);
$datets = $dom->createAttribute("timestamp");
$station->appendChild($datets);
$datev = $dom->createTextNode($date);
$datets->appendChild($datev);
$urtag = $dom->createAttribute("destination");
$station->appendChild($urtag);
$urval = $dom->createTextNode($ur);
$urtag->appendChild($urval);
}
}
}
}
}

header("Content-Type: text/xml");
$xslsheet = $dom->createProcessingInstruction('xml-stylesheet','type="text/xsl" href="STARnet4.xsl"');
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
$dom->appendChild($xslsheet);
$root = $dom->createElement("ircDDBGateway");
$dom->appendChild($root);
$ver = $dom->createElement("version");
$root->appendChild($ver);
$vert = $dom->createTextNode("1.2");
$ver->appendChild($vert);
$dt = $dom->createElement("datetime");
$root->appendChild($dt);
$dtstr = $dom->createTextNode(date('Y-m-d H:i:s T'));
$dt->appendChild($dtstr);
$gatecall = $dom->createElement("server");
$root->appendChild($gatecall);
$gatecallv = $dom->createTextNode($callsign);
$gatecall->appendChild($gatecallv);
$sponsorx = $dom->createElement("sponsor");
$root->appendChild($sponsorx);
$sname = $dom->createTextNode($sponsor);
$sponsorx->appendChild($sname);
$regnode = $dom->createElement("registerURL");
$root->appendChild($regnode);
$regtext = $dom->createTextNode($registerURL);
$regnode->appendChild($regtext);
$titlenode = $dom->createElement("title");
$root->appendChild($titlenode);
$titlestring = $dom->createTextNode($title);
$titlenode->appendChild($titlestring);
baseValues($dom,$root,$configs);
$root->appendChild(buildgroupinfo($dom,$configs,$starLogPath));
$root->appendChild(buildrepeaterinfo($dom,$configs));
#addgroups($dom,$root,$starLogPath);
addstations($dom,$root,$hdrLogPath);
addlinks($dom,$root,$linkLogPath);
echo $dom->saveXML();
?>
DO9ATV
 
Posts: 5
Joined: 02. September 2011 12:33

Re: XAMPP Windows XML,XSL

Postby DO9ATV » 05. September 2011 22:33

Hallo,

oder ist hier etwas falsch, Auszug der php.ini:

[mbstring]
; language for internal character representation.
; http://php.net/mbstring.language
;mbstring.language = Japanese

; internal/script encoding.
; Some encoding cannot work as internal encoding.
; (e.g. SJIS, BIG5, ISO-2022-*)
; http://php.net/mbstring.internal-encoding
;mbstring.internal_encoding = EUC-JP

; http input encoding.
; http://php.net/mbstring.http-input
;mbstring.http_input = auto

; http output encoding. mb_output_handler must be
; registered as output buffer to function
; http://php.net/mbstring.http-output
;mbstring.http_output = SJIS

; enable automatic encoding translation according to
; mbstring.internal_encoding setting. Input chars are
; converted to internal encoding by setting this to On.
; Note: Do _not_ use automatic encoding translation for
; portable libs/applications.
; http://php.net/mbstring.encoding-translation
;mbstring.encoding_translation = Off

; automatic encoding detection order.
; auto means
; http://php.net/mbstring.detect-order
;mbstring.detect_order = auto

; substitute_character used when character cannot be converted
; one from another
; http://php.net/mbstring.substitute-character
;mbstring.substitute_character = none;

; overload(replace) single byte functions by mbstring functions.
; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(),
; etc. Possible values are 0,1,2,4 or combination of them.
; For example, 7 for overload everything.
; 0: No overload
; 1: Overload mail() function
; 2: Overload str*() functions
; 4: Overload ereg*() functions
; http://php.net/mbstring.func-overload
;mbstring.func_overload = 0

; enable strict encoding detection.
;mbstring.strict_detection = Off

; This directive specifies the regex pattern of content types for which mb_output_handler()
; is activated.
; Default: mbstring.http_output_conv_mimetype=^(text/|application/xhtml\+xml)
;mbstring.http_output_conv_mimetype=

; Allows to set script encoding. Only affects if PHP is compiled with --enable-zend-multibyte
; Default: ""
;mbstring.script_encoding=

Mfg Marco
DO9ATV
 
Posts: 5
Joined: 02. September 2011 12:33

Re: XAMPP Windows XML,XSL

Postby Nobbie » 07. September 2011 01:49

DO9ATV wrote:Unter z.B. Opera läuft das auch soweit, nur IE macht mir die Probleme.


Selbstverständlich, denn das ist ja genau die entscheidende Zeile, die für IE etwas anderes unternimmt als für alle anderen Browser:

Code: Select all
if(strstr($_SERVER['HTTP_USER_AGENT'],'MSIE')) header("Location: index2.php");


D.h., nur für den IE wird auf die Datei index2.php weitergeleitet (warum auch immer).

DO9ATV wrote:Er sagte, da IE die eigentliche Sprache nicht versteht hat er die zusätzliche "Notlösung" mit XML gewählt.


Hä? Was ist das denn für eine kaputte Aussage? Welche "eigentliche" Sprache versteht IE nicht, die aber alle anderen Browser verstehen? Selten so einen Quatsch gelesen.

DO9ATV wrote:Da die User, welche auf die Webseite zugreifen zum Großteil auch mit IE arbeiten muss ich dieses auch anbieten.
Jedoch kann ich den Fehler nicht finden, trotz suche im Internet. Laut php soll das alles so passen, eher schrieben die,
das XML unter Windows XAMPP also php nicht untersützt werden solle , nur unter XAMPP für Linux ?


Dass Du den Fehler "nicht findest", wird wohl in erster Linie daran liegen, dass Du keinerlei Kenntnisse über PHP, XML usw. besitzt. Das soll aber auch nicht Dein Problem sein, ich würde Dir empfehlen, lösche einfach die o.g. Zeile aus index.php (die für IE einen Sonderfall macht) und schaue, was passiert. Ich wüßte keinen Grund, wieso IE und Opera anders behandelt werden sollen.

Das hat auch mit Linux/Windows/Xampp nichts zu tun, auf "Apache Ebene" sollte das alles portabel zueinander sein. Wenn es dann immer noch nicht geht, musst Du eben den Autor darum bitten, sein Script zu debuggen. Das ist generell hier auch falsch aufgehoben, denn mit Xampp oder WIndows hat das nichts zu tun.
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04

Re: XAMPP Windows XML,XSL

Postby DO9ATV » 07. September 2011 12:03

Hallo Nobbi,

dann bekomme ich nur einen blauen Bildschirm. Das kannst Du sehen, wenn Du auf http://herzberg-harz.dyndns.org:81/index.php zugreifst. Der Quellcode sieht doch auch gut aus, verstehe nicht, warum Opera das richtig
darstellt und IE nicht ;-(
Der Autor ist ein Linux-Guru und hat mir geholfen, das so weit wie möglich für Microsoft umzuändern. Ich habe für IE alle / auf ein \ umgesetzt, doch selbst das bringt nichts. Ein solches Problem hatte ich
nämlich schon mal, Opera ist es egal, ob ein / oder \ sitzt, IE nimmt das schon genauer. Er kann mir im Bezug unter Microsoft Webserver auch nicht weiterhelfen sagte er.
Könntest Du mal auf die Seite zugreifen und dir den Quellcode anzeigen lassen , ob Dir was ins Auge fällt?

Mfg Marco
DO9ATV
 
Posts: 5
Joined: 02. September 2011 12:33


Return to XAMPP für Windows

Who is online

Users browsing this forum: No registered users and 14 guests