I get this error message when I try and run php on my remote webserver (windows based not Linux):
'No input file specified'
It works ok on my computer server (apache) and parses the XML file, but on my website server it doesn't work. My code is basically the same as the code in the XML chapter, but slightly modified to suit my purpose. This is not the problem as it parses XML ok on my PC.
Here is my code:
Code:
<?php
// Open the Termine file
$xmlTermine = fopen("http://www.bungert.co.uk/tests/alicehoffmann_updater/xml/termine.xml", "r");
if (!$xmlTermine) die ("Cannot open file");
$itemCount = 0;
$itemData = array();
$currentTagState = '';
// Define callback functions
function startElementHandler($parser, $elementName)
{
global $itemCount;
global $itemData;
global $currentTagState;
$currentTagState = $elementName;
}
function endElementHandler($parser, $elementName)
{
global $itemCount;
global $itemData;
global $currentTagState;
$currentTagState = '';
if ($elementName == "ITEM")
{
$itemCount++;
}
}
function itemDataHandler($parser, $data)
{
global $itemCount;
global $itemData;
global $currentTagState;
// Return if $currentTagState is empty
if ($currentTagState == '')
{
return;
}
// Otherwise put data in the array for later use
if ($currentTagState == "DATUM")
{
$itemData[$itemCount]["datum"] = $data;
}
if ($currentTagState == "ORT")
{
$itemData[$itemCount]["ort"] = $data;
}
if ($currentTagState == "ZEIT")
{
$itemData[$itemCount]["zeit"] = $data;
}
if ($currentTagState == "HALLE")
{
$itemData[$itemCount]["halle"] = $data;
}
if ($currentTagState == "STÃCK")
{
$itemData[$itemCount]["stück"] = $data;
}
}
// Create XML parser
$xmlParser = xml_parser_create();
if (!$xmlParser) die ("Couldn't create XML Parser");
xml_set_element_handler($xmlParser, "startElementHandler", "endElementHandler");
xml_set_character_data_handler($xmlParser, "itemDataHandler");
while ($data = fread($xmlTermine, 4096))
{
if (!xml_parse($xmlParser, $data, feof($xmlTermine)))
{
break; // Get out of while loop when finished with the file
}
}
xml_parser_free($xmlParser);
?>
<html>
<head>
<title>Alice Hoffmann: Website Updater * TESTING *</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta http-equiv="imagetoolbar" content="false">
<meta name="MSSmartTagsPreventParsing" content="true">
</head>
<body>
<?php
echo "XML file parsed, it contains the following termine items:<br><br>";
for ($index = 0; $index < $itemCount; $index ++)
{
echo "Datum is: <b>" . $itemData[$index]["datum"] . "</b><br>";
echo "Ort is: <b>" . $itemData[$index]["ort"] . "</b><br>";
echo "Zeit is: <b>" . $itemData[$index]["zeit"] . "</b><br>";
echo "Halle is: <b>" . $itemData[$index]["halle"] . "</b><br>";
echo "Stück is: <b>" . $itemData[$index]["stück"] . "</b><br><br>";
}
?>
</body>
</html>
Anyone know what the problem might be? I searched Google but every one with this problem seems to have a different reason, there doesn't seem to be one reason for this error message.